2 Ways To Split A Workflow And Handle Conditional Logic

Here are some different ways to handle conditional logic in MESA.

Watch The Demo

1. Splitting A Workflow – Simple Version

Let’s say that you want one thing to happen under one condition and another thing to happen under another condition. We don’t currently have standard if/else type blocks, but it’s usually pretty easy to workaround that with a little bit of custom code.

This one works by hitting Edit Code on the Filter by MESA step and adding this code to the else condition,, where the string shopify_2 is the key of the workflow step after the else condition:

Mesa.output.send('shopify_2', payload);

2. Splitting A Workflow Using A Sub-Workflow

This one can be useful for longer or more complicated workflows where you want to fire off a separate sub-workflow in the else condition.

This one works by hitting Edit Code on the Filter by MESA step and adding some this code to the else condition, where the key you’re passing in is the key of the subworkflow:

Mesa.automation.send('splitting-a-workflow---advanced-version---subworkflow', context.steps);

And here is the sub-workflow being called:

How do I use this demo file?

  1. Add MESA from the Shopify App Store. Enjoy a 7-day free trial to start.
  2. Import this download to My Workflows. Navigate to your automations then follow the prompt to import a workflow. Upload the downloaded ZIP file from this demo.
  3. That's it! Personalize any step if you want. You got this.
  4. Questions? Shoot me an email: [email protected]
We literally wrote the book on Shopify automation

Learn how to make Shopify work easier with your business processes.

Get the playbook - Free!

shopify automation playbook PDF