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

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 >=

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

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:

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

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