Shopify Flow - Adding Code for Math

ap96
Tourist
6 0 1

Screenshot 2023-07-19 at 2.40.34 PM.png

I set up a Flow earlier today that will check if a product variant has a compare-at price that exists and then have it update the metafield of that product but I am now trying to create a flow with a bit more detail. I am curious if anyone knows a work around or code to add to the section of "Check if..." so that the base price reads more 40% off of the compare-at price? Would this be the send http request option?

Replies 2 (2)

paul_n
Shopify Staff
952 128 225

Math needs to be handled in liquid currently. Depending on your scenario, you could do that in the Update product metafield action. Something like {{ product.variant.price | times: 0.4 }}

 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
paul_n
Shopify Staff
952 128 225

Note that Flow just released a Run code action, which makes it much easier to do math in Flow in and use the results in subsequent steps.

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.