Combine discount function and cart transformation

Combine discount function and cart transformation

robin_sch
Shopify Partner
7 2 0

Hello Shopify Community,

We're experiencing a challenge involving the interplay of cart transformation and automatic discount functionalities on our store. Specifically, we have set up an automatic discount feature that provides a 100% discount for selected product variants. Concurrently, we use a cart transformation function that merges multiple line items into a single bundle.

 

The issue arises when these functions interact. It appears that when items are bundled together, the discount is not applied to them. My understanding is that the cart transformation (merging line items) occurs prior to the application of the discount, resulting in only the parent bundle product being recognized by the discount function.

 

This observation is based on our logs, where only the parent bundle product is processed by the discount function.

 

Could anyone provide insights or guidance on the following points?

  1. Is there a way to access the contents of a bundle within the discount function?
  2. Can the order in which these functions (cart transformation and discount application) are executed be modified to ensure discounts are applied correctly to bundled items?

Any assistance or direction to relevant documentation would be greatly appreciated. We're keen to ensure that our customers can enjoy the intended discounts, even when purchasing bundled products.

Thank you in advance for your help!

Für direkten Support kontaktiert mich gerne und wir finden eine individuelle Lösung.
Replies 2 (2)

Nick_Wesselman
Shopify Staff
167 42 65

Hi @robin_sch. I confirmed with team that the bundle components are not available to discounts, and Functions definitely don't have a mechanism for affecting execution order.

 

I'd recommend posting a feature request with more information about your use case. Since bundles themselves can update pricing, it'd be helpful to know more about the scenario in which the bundle should inherit discounts from the components as well.

Nick Wesselman | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

robin_sch
Shopify Partner
7 2 0

Hey @Nick_Wesselman thank you for confirming with your team. I opened a discussion here: https://github.com/Shopify/function-examples/discussions/434

Für direkten Support kontaktiert mich gerne und wir finden eine individuelle Lösung.