How can I automate tag creation based on discounted price in Flow?

Hi - I want to create a flow that auto creates a tag based on the discounted price of a product - so it would need to do a calculation [(price / compare at price) - 1] - is this possible?

any advice gratefully received!

thanks

Yes, possible. You likely need to put Liquid in the tag field (and hit enter to save the tag). Something like:

{{ productVariant.price | divided_by: productVariant.compareAtPrice | minus: 1 }}

One note…depending on the trigger you may not have access to productVariant, or you’ll need to loop over lineItems (for orders) or variants (for product triggers)

Hi Paul - great - I want to round the discount level in the tag but am getting an error

  • {{{{ productVariant.price | divided_by: productVariant.compareAtPrice | minus: 1 }} | round: 2 }}

Liquid syntax error: Unexpected character { in “{{{{ productVariant.price | divided_by: productVariant.compareAtPrice | minus: 1 }}”

Any help gratefully received!

I think you need to move the round inside the curly brackets. Try:

{{ productVariant.price | divided_by: productVariant.compareAtPrice | minus: 1 | round: 2 }}

1 Like