Adding product Y automatically when clicking add to cart for product X

Adding product Y automatically when clicking add to cart for product X

Stormmmneo
Shopify Partner
1 0 0

Hi!
May I know or get some help regarding adding a freebie product Y that shows up in the cart drawer when clicking on add-to-cart for product X? 

An example is the image below where the second product is added automatically when a customer add the crystal hair to cart.

I've tried a few ways with the product ID through the const form but i think i may be adding it wrongly

Screenshot 2025-01-07 011258.png

thanks so much!

Reply 1 (1)

gr_trading
Shopify Partner
2049 149 207

Hi @Stormmmneo ,

 

You can write a custom code which will watch the cart data and when it matched with your criteria and fire script to add free bee item.

you can use code provided in below URL to add freebie in account.

 

https://shopify.dev/docs/api/ajax/reference/cart


For any custom development WhatsApp or connect at Email ID: support@grtrading.in for quick consultation. | Shopify Free codes
To support Buy Me a Coffee