How can I manage stacking/combining of discounts between Cart Transform and Discount Functions?
I created a Cart Transform that updates the price on some lineItems based on a buyerIdentity.
However Discounts are further modifying prices which is not acceptable.
Is there a way for Cart Transform Functions to control if Discounts are applicable?
Is it the case that I need to re-implement using a Discount Function (which appear to have more control over stacking/combination with other discounts?
Functions execute in order: Cart transform function → Discount function. Depending on what exactly you’re doing in the cart transform, you could add an attribute, which can then be read-able in a discount function (not avail in the update operation sadly). I suppose like everything (boring I know!), it depends on exactly what you’re trying to achieve!
1 Like
Thanks for your input. I’m trying to achieve disabling Discounts when my cart transform function has applied price changes. I don’t actually have a Discount function, its just regular shopify Discounts applying on top of my price change.
Righto! Yea, you’re probably better off using a discount, as you can set the combinesWith value of that function + the other discounts in question. I would say that it’ll still be a little complicated as it’s not possible to specify ordering/sequence or priority in discounts.
Appreciate the guideance. Discount Functions were launched after I spec’d out this idea using Cart Transform. It seems in hindsight Cart Transform is not ideal for discounting prices but rather adjusting baseline prices and discount API is how this should in fact be implemented. Knowing what the ideal implementation is what I’m really trying to gain here. Though I don’t want to undertake rewriting in the Discount Funciton API just yet!
Thankfully I should be able to only apply all my Shopify discounts to a customer segment that is the inverse of who my Cart Transform is targeting (as a bit of a hack).
1 Like