How can I tag orders with discounts using Flow in Scripts?

How can I tag orders with discounts using Flow in Scripts?

greg-gkr
Shopify Partner
21 0 8

We're using Scripts to discount line items based on certain criteria using the  `change_line_price` method in the script. Is there some way in Flow to see if line item prices have been adjusted and tag the order as having discounts?

 

I tried a few triggers in flow like

If order  cartDiscountAmountSet  shopMoney  amount is greater than 0

but it isn't tagging the order. The notes on the order show that the Flow was run against the order. Should I be using a different value to check? Is this cartDiscountAmountSet value only set for discount codes?

 

Thanks

Replies 2 (2)

KJ_Kevin
Shopify Partner
4 0 1

Great question, and I'd like to be able to do this too.

My first thought was to see if order.totalDiscountsSet.shopMoney.amount > order.cartDiscountAmountSet.shopMoney.amount, since only order.totalDiscountsSet.shopMoney.amount contains line item script discounts. However, it seems we can't compare multiple variables in Flows at this time, we can only compare a variable with a static number.

So I'll go back to the drawing board and maybe have to do this with a private app/webhook or possibly an Arigato Automation.

It would be really nice if Shopify provided a data source for which Script Editor scripts made edits to an order so those could be more easily tracked for reporting and finances.

evaldas_92
Shopify Partner
60 1 27

Have you tried "order - total discount set - shop money" amount is greater than 0?

I haven't tried it with discounts applied through scripts, but I would've thought that should include all discounts, regardless of source.