Personalized checkout and custom promotions with Shopify Scripts
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.
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
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.
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
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.
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.
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025