To implement this functionality, you can create a custom discount code in Shopify that applies a percentage discount to the original, non-discounted price of each individual product in the bundle.
When a customer applies the discount code, you can use Shopify’s API to calculate the new discounted price for each product in the bundle, and then calculate the total price of the bundle based on those individual discounted prices.
Here’s an example workflow:
Create a discount code in Shopify that applies a percentage discount to each individual product in the bundle.
When a customer applies the discount code, use Shopify’s API to retrieve the original, non-discounted price of each product in the bundle.
Calculate the new discounted price of each product by applying the discount code to the original price.
Calculate the total price of the bundle based on the discounted prices of each product.
Display the new bundle price to the customer.
You can use a Shopify app or a custom script to implement this workflow. Cart.js is a JavaScript library that can help you build custom cart functionality, but it’s not necessary to use it for this specific use case.