We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

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
4812 598 1733

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, hit the thumb up button -- it will help others with similar problem to find a solution.
I can be reached via e-mail tairli@yahoo.com

Kalen_Jordan
Shopify Partner
803 39 148

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