Add an item to cart automatically if another item is in it.

seangerke
Excursionist
39 0 1

I am trying to have the customer do fewer steps buy adding this.

 

If the customer adds this one Event to the cart, I want the cart to automatically add this product. It has no variants, just one product.

 

I followed this: https://community.shopify.com/c/Shopify-Design/Add-Companion-Multiple-products-to-basket-when-specif...

 

And then found out I have an Ajax cart.... womp womp....

 

So I have tried making a form and adding an extra button for the product.

My product id for the item that needs to be added is 6619002634270.

 

I tried forcing the "Add to Cart" button to add it as well, all I could get is an event product with the cartridge products title. That was weird.

 

my site is:

 

orders.biomodex.com

 

The steps are:

 

Add Event: Patient Specific Rehearsal (this auto adds the product: Patient Specific Cartridge) to the cart.

 

I literally pulled my hair out trying to get this to work they way I want to. Any suggestions?

0 Likes
Tejas_Nadpara
Shopify Partner
1027 215 479

@seangerke 

 

This solution does require working with code and Liquid files, and if this is something you would not be comfortable with, I would advise you to reach out to one of Shopify Experts, or contact me by mail. As always, when making code changes to your theme, please remember to create a backup, in case you need to revert back to previous versions of the theme. 

 

Thank you,

Tejas

Shopify Expert | Skype: tejas.nadpara
- Like and Mark as an Accepted Solution if reply helpful
- Feel free to contact me on support@hexaecommerce.com regarding any help
0 Likes
Jasoliya
Shopify Expert
4136 569 1000

Hi @seangerke 

In which condition you want to add extra product to cart?

Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com Or WhatsApp Or Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here
0 Likes
seangerke
Excursionist
39 0 1
Jasoliya,

I have one product that has a companion. Currently, it is a two step process. If you add this special event to your cart. You must add this 2nd product to your cart as well. This is the only time I would need this to work. One specific time. If you add event A you must add item B...

I am pretty deep into code but I still consider myself a novice. I usually edit code parameters, but not sure what everything needs or how it works.
0 Likes
Jasoliya
Shopify Expert
4136 569 1000

So you want like if product A in product then we need to add auto product B?

Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com Or WhatsApp Or Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here
0 Likes
seangerke
Excursionist
39 0 1
Yes, if product A is in cart auto add product B.

0 Likes
seangerke
Excursionist
39 0 1

I tried this:

 

{% for item in cart.items %}
{% if item.product.id == "29056231440487" %}
jQuery.post('/cart/update.js',
{
quantity:1,
id: 6619002634270

});

This is what I came up with but still not working. Am I adding the wrong IDs? First picture goes to the top, 2nd pic is reference to product I want added.product Aproduct A

product Bproduct B

0 Likes
Jasoliya
Shopify Expert
4136 569 1000

In this give instruction you can do this but need to change some code in Js to work with your condition.

Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com Or WhatsApp Or Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here
0 Likes
Jasoliya
Shopify Expert
4136 569 1000

But you need to add this Js code within  <script> tag

Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com Or WhatsApp Or Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here
0 Likes
seangerke
Excursionist
39 0 1

Thank you for reaching out. I have given up on this part and modified the "add-on" to just be automatically included on the back end.

0 Likes