Adding multiple products to cart via one product page's "Add to Cart" button

Adding multiple products to cart via one product page's "Add to Cart" button

ianRogers
Visitor
2 0 0

I am working on creating a bundle. Currently if XYZ skus are in the card, I have a script that will recognize that and Bundle them together and apply a discount for that bundle. On the other end, adding the products via 1 click.

Let's say that I create a Product page for bundle XYZ skus. I want to just click that "Add to Cart" button and it will automatically put XYZ skus in the cart. So one click can add 3 separate products in the cart. I also need to account for inventory. If one of the skus XYZ is out of inventory. This bundle would not be able to be added to the cart. After that my script can do the calculations for discounts and pricing.

Replies 5 (5)

jam_chan
Shopify Partner
938 24 193

You can use cart API to add individual items to the cart: https://shopify.dev/api/ajax/reference/cart

 

Just override the add to cart button to call the API

BYOB - Build Your Own Bundles, SPO - SEO App to research keywords & edit social link preview

Simonsron
Shopify Partner
699 87 123

First: you need to look at how the XYZ binding of three products, and get the three products id:

Second: you can call shopify provide API: / cart/add js items inside a parameter value is an array, and then added to this array
You can go to  https://shopify.dev/api/ajax/reference/cart ,If you have any do not understand, at any time consulting me.

banned

davehollister
Visitor
1 0 0

Hi Ian - I am looking to create a script to adds multiple products (a bundle) from a product page button click, with a discount for the bundle. Would you be willing to share some details about your script that does this? I'm hoping to not use an app do do this - and it sounds like you have done it. Any insight you can provide would be great. Thanks!

-Dave

DavidXverse
Shopify Partner
1 0 0

You might find this app useful for what you’re trying to do: MultiATC - Buy Button Anywhere.
It lets you create a button that adds multiple products to the cart at once, even on a custom bundle product page. It also respects inventory, so if one item is out of stock, it won’t add the bundle.

gr_trading
Shopify Partner
2053 149 208

Hi @ianRogers ,

 

We can custom code this feature for any theme to provide add to cart CTA for related product from cart page or drawer. We have implemented this feature where we provides option to map product as related.

 

When any of that product is in cart we make it mandatory to add related product in cart if not added.

 

In your case you just need to remove the mandatory validation and instead of linking the product we can provide the option of adding it into the cart.

 

Please refer the below video to see it in action.

 

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