Use of Liquid variables in an IF condition

Topic summary

A user wants to create a Shopify Flow workflow that runs every Monday but only proceeds if the next day (Tuesday) falls within the first week of the month (1st-7th). The default schedule-based triggers lack this level of sophistication.

Problem: The user attempted to use Liquid variables directly in an IF condition but wasn’t sure if this was possible or where to enter the logic.

Solution provided: Liquid cannot be used directly within Flow conditions. Instead, the “Run code” action should be used before the condition to execute Liquid logic and generate variables that can then be evaluated in subsequent IF conditions.

Resources shared:

  • GitHub repository with Flow code examples similar to this use case
  • Official Shopify documentation on the Run code action

Status: The original poster acknowledged the solution and plans to investigate the Run code action approach.

Summarized with AI on November 2. AI used: claude-sonnet-4-5-20250929.

I would like to use Liquid in a Shopify Flow IF condition. Is this possible? If so, where should I enter my Liquid logic? (See image below.)

My workflow is scheduled to run every Monday: but I only want it to proceed if the following day (Tuesday) will be during the first week of the month (so 1st - 7th inclusive); otherwise I want it to quit. The default schedule-based triggers aren’t sophisticated enough to do that, so I am trying to create the same effect with an IF condition.

You can’t use liquid in the condition, but you can before the condition using Run code. In fact there are some examples here that are similar to your use case:

https://github.com/Shopify/flow-code-examples/tree/main/run-code-examples

Which is linked to from this page:

https://help.shopify.com/en/manual/shopify-flow/reference/actions/run-code

2 Likes

Thanks Paul - I didn’t know about the Run code action. I’ll investigate.