How to check if metafield value is greater than or equal to number in Shopify Flow

How to check if metafield value is greater than or equal to number in Shopify Flow

arishi
Shopify Partner
1 0 1

I want to craft workflows that add and remove loyalty points (custom metafield) based on orders being processed.

However, it seems like when using conditions on metafield values they are assumed to be strings. This means you can't use conditions like >=

Screenshot 2024-04-12 at 5.36.27 PM.jpg

Does anyone have a solution to this? I'm sure that the type of the metafield in question is an integer.

Replies 2 (2)

tim
Shopify Partner
3765 351 1385

Flow treats any metafield value as a string, so you can't do it this way.

 

There is a workaround, however.

You should change the flow to "order paid" --> "action: set metafield on order.customer" and put your logic inside liquid code in metafield value field.

Kinda like this -- would require further testing though:

Screenshot 2024-04-13 at 1.32.40 am.png

Also see https://help.shopify.com/en/manual/shopify-flow/reference/variables 

If my post is helpful, consider liking it -- it will help others with similar problem to find a solution.
I can be reached via e-mail [email protected]

Kalen_Jordan
Shopify Partner
743 34 130

Should be able to use a run code step and cast to integer.