My store sells Tool Fees. If you pay the fee, you get to use the tool for a year. (We’re a makerspace. Please don’t judge)
Each customer has a metafield that stores their Tool Fee expiration date. In this case it’s called tool_fee_wood_shop
Therefore, I’m trying to make a Shopify Flow with the following logic.
When Wood Shop Tool Fee is paid
if tool_fee_wood_shop does not exist, assign tool_fee_wood_shop = today’s date 1 year in future
else, if tool_fee_wood_shop < ‘now’, assign tool_fee_wood_shop = today’s date 1 year in future
else tool_fee_wood_shop >= ‘now’, assign tool_fee_wood_shop = that date 1 year in future
I can create steps 1 and 2 in a Shopify Flow.
Trigger: order paid
Condition: if tool_fee_wood_shop is empty
But when I try to create step 3, Condition: if tool_fee_wood_shop < ‘now’, the system won’t let me selecttool_fee_wood_shopa second time. It says “Alias Added,” but I can’t see how to put that metafield into the comparison.
How can I use the same metafield in two conditions?
Every time, no matter what, the tool_fee_wood_shop is set to today’s date plus one year. It’s almost like the if is completely ignored?
Unfortunately, that’s not all. For whatever reason, the code to advance the date stored in the metafield by 1 year doesn’t work either. When I put just that line in:
My bad, I could’ve worded that better. The text you referenced was just to explain what I wanted the code to do. It wasn’t supposed to be actual liquid code. I appreciate the response, though!
Of course – the order.customer.metafields.value is not the proper way to address a MF in Flow.
Therefore mfValue always uses default and turns to be the same as orderDate
When you reference a MF in Flow it creates an alias and you must use that one.
I guess, if your metafield is customer.metafields.custom.tool_fee_wood_shop, then the alias would be toolFeeWoodShop and proper reference would be customer.toolFeeWoodShop.value
You can use “Add variable” functionality to see it and then use in my code (which was also not 100% proper – sorry about that )
I’d be thinking something like this should be the next step I’d try:
Sorry to keep asking questions. First of all, thank you, tim_1, your code worked great!
How do you find the alias that Flow assigns to a metafield? In your comment above you guessed the alias name and were spot on.
Now I’m trying to create a Metal Shop Tool Fee flow. It works just like the Wood Shop Tool Fee flow except it’s looking at a different metafield. I took a similar guess at the alias for that metafield but my guess was incorrect.
You do not need to guess – click “add variable”, select your object from the list, scroll to metafield (not metafields!) and pick the alias from there.
Basically – the next step from your last screenshot – after you make selection, it will create an alias and then you click this alias to add to the input field.