Shopify discount function apply to whole cart

Hello! Just created my first discount function extension by using this tutorial: https://shopify.dev/docs/apps/selling-strategies/discounts/experience/getting-started

Logic for applying the discount is about a customer has a tag (or not), but I can’t make the discount target to whole cart, i made a workaround by setting target to all lines.

Docs talks about orderSubtotal don’t know if that’s I need, but javy compiler complains if I try to use it: https://shopify.dev/docs/api/functions/reference/order-discounts/graphql/common-objects/target

If this field is not “my solution” and there is no way for setting up a cart discount instead cart lines discounts, please tell me. Thanks in advance!

Hey @JPastorOnestic

You’ll want to create an order discount (instead of a product discount).

Let me know if you get stuck!

Hi!! Yes, that was the issue, i was following the tutorial that was using product discount function extension. Now restarting my Functions App and seems is working fine. Thanks!! :grinning_face_with_smiling_eyes:

1 Like