My app creates a product for each bundle, which supports cart transformation - expand and merge operations.
There is a common request. Users want to exclude a bundle from the existing discounts. This is because the bundle has been eligible for a bundle discount. The stores don’t want to offer an extra discount on the bundle. But I don’t find any way to do so. The stores can only check each discount and exclude the bundle products manually, which causes a headache. Is there an easier way to do so?
I want to post the thread with regards to discounts. But I don’t find a relevant board for discounts here.
I’m not sure what level of access your app/you would have on your client’s shops, but you could create a collection specifically for those bundled items and exclude that collection from any discounts. Let me know if this works for you - happy to keep looking into this if needed
@Alan_G My app can access products, collections, discounts, orders, etc.
Sometimes, the users may have many existing discounts, either created by themselves or created via 3rd party apps. It may be hard to edit these discounts one by one manually.
The logic is something if (at least a cart line item has a specific attribute, or with a special tag, or a bundle group) AND there is a discount => then don’t allow checkout.
I’m afraid the discount is not available in the cart but only in checkout
Hey again @Benny_Chan, you’re right that cart validation functions don’t have direct access to discount fields in their input - they can only see line item attributes, prices, and metafields.
You should be able to implement a workaround by adding attributes to bundle line items (like is_bundle_component: true), more info here and comparing the actual price against an expected bundle price stored in a metafield on the product(s) itself to detect if additional discounts have been applied.
This approach does have some limitations since you can’t see which specific discounts are applied and you would need to make additional Storefront API calls to get the metafield of the bundled product, it could help prevent checkout when unwanted double-discounting is detected on bundles.
You should also be able to use Shopify Functions for discounts to exclude certain products at the discount calculation level rather than trying to validate after discounts are applied if you wanted to take a look at that route.
Let me know if I can clarify anything as always on my end here - happy to help!