Mastering Overnight Order Holds: Automating Fulfillment Releases with Shopify Flow

Hey there, fellow store owners! Ever found yourself wishing you had a little more control over those overnight orders before they zoom off to fulfillment? You know, that precious window to catch a cancellation request or a last-minute change before it’s too late?

It’s a super common challenge, and it popped up recently in the Shopify community. A store owner, Jiminy’s (shoutout to hello_3463!), asked for help fine-tuning their Shopify Flow setup to do just that: automatically hold all orders placed overnight and then release them precisely at 8:30 AM each morning. It’s a brilliant strategy for customer service and operational efficiency, and I’m excited to dive into the solutions our community expert tim_1 shared.

The Challenge: Pinpointing Overnight Orders in Shopify Flow

Jiminy’s had a solid start. They’d already set up two key workflows:

  • Workflow 1 (Order created): This one triggers when a new order comes in and immediately puts a hold on its fulfillment.

  • Workflow 2 (Scheduled time): This workflow is set to run daily at 8:30 AM. The goal here was to release those held orders.

The snag? In Workflow 2, after adding the "Get order data" action, Jiminy’s couldn't find a straightforward "common order search" option to specifically filter for only the orders placed overnight that were currently on hold. They needed a way to tell Flow, "Hey, only grab the orders from, say, 5 PM yesterday until 8:30 AM today, and release *those*."

Solution 1: The Date-Based Query – Precision with Liquid

Our community expert, tim_1, jumped in with a fantastic solution, and it’s one Jiminy’s was already testing! This approach leverages the power of Shopify Flow’s "Get order data" action and some clever date filtering.

How it Works: Filtering by Creation Date

When you're configuring the "Get order data" action in Workflow 2, you can specify exactly which orders Flow should retrieve. tim_1 pointed out a couple of ways to do this:

  1. Simple Filter: "Created at the last day"

    For a quick setup, you can use the built-in filter option: "Created at the last day". This will grab all orders created within the last 24 hours relative to when Workflow 2 runs. This is a good starting point if your overnight window is roughly 24 hours.

  2. Advanced Filter: Precise Liquid Query

    For more exact control, tim_1 shared a Liquid query that lets you define your time window much more precisely. This is perfect if you want to say, "only orders created after 5 PM yesterday and before 8:30 AM today."

    Here’s the query provided:

    created_at:<=\'{{ scheduledAt }}\' AND created_at:>\'{{ scheduledAt | date_minus: "24 hours" }}\'

    Let's break that down a bit:

    • created_at:<=\'{{ scheduledAt }}\': This ensures you're only looking at orders created *before or at* the current scheduled run time (8:30 AM today).
    • AND created_at:>\'{{ scheduledAt | date_minus: "24 hours" }}\': This narrows it down to orders created *after* 24 hours before the current scheduled run time.

    You can tweak "24 hours" to match your specific overnight window. For instance, if you want orders from 5 PM yesterday, you'd calculate the difference in hours from 8:30 AM today back to 5 PM yesterday and adjust the date_minus value accordingly. This query ensures you're only processing orders that fall within your desired overnight window.

Step-by-Step for Workflow 2 (Date-Based)

Here’s how you’d set up Workflow 2 using this method:

  1. Trigger: Scheduled time (set for 8:30 AM daily).

  2. Action: Get order data.

    • In the configuration for "Get order data," use either the "Created at the last day" filter or, for more precision, paste the Liquid query into the custom query field.
  3. Action: For each (this will iterate through all the orders found by the "Get order data" step).

  4. Action (inside "For each"): Release fulfillment order.

    • Make sure this action targets the order found in the current iteration of the "For each" loop.

Solution 2: The Tag-Based Approach – Clearer Identification

tim_1 also suggested another robust method that offers even clearer segmentation: using order tags. This approach is fantastic because it explicitly marks the orders you want to hold and release, making your Workflow 2 query incredibly straightforward.

How it Works: Tagging Orders on Hold

This method involves modifying your first workflow and creating a very specific query for your second workflow.

Step-by-Step for Workflow 1 (Tag-Based)

You'll need to enhance your existing "Order created" workflow:

  1. Trigger: Order created.

  2. Action: Hold fulfillment order.

  3. Action: Add tags to order.

    • Add a unique tag like on_hold_overnight or release_at_830am. This tag acts as a flag for your second workflow.

Step-by-Step for Workflow 2 (Tag-Based)

Now, your scheduled workflow becomes much simpler to configure:

  1. Trigger: Scheduled time (set for 8:30 AM daily).

  2. Action: Get order data.

    • In the configuration, use the query tag:on_hold_overnight (or whatever tag you chose). This tells Flow to only retrieve orders that have this specific tag. This is a very precise way to identify *only* the orders you intentionally placed on hold via Workflow 1.
  3. Action: For each.

  4. Action (inside "For each"): Release fulfillment order.

  5. Action (inside "For each"): Remove tags from order.

    • Crucially, remove the on_hold_overnight tag once the order has been processed and released. This prevents the same order from being picked up and processed again in subsequent runs, keeping your system clean and efficient.

Which Approach is Right for You?

Both of these solutions are solid, and the choice often comes down to personal preference and the specific nuances of your store's operations. Jiminy’s was testing the date-based approach, which is perfectly valid.

  • Date-Based (Solution 1): Great if your "overnight" window is always a consistent past duration (e.g., "last 24 hours" or "last 15 hours"). It's more about timing relative to the scheduled run. It’s slightly more complex with the Liquid query if you need super precise, non-24-hour windows, but very powerful.

  • Tag-Based (Solution 2): This often feels more explicit and robust. By tagging orders, you're creating a direct flag that says, "This order needs to be released by Workflow 2." It avoids any potential edge cases with date calculations if your scheduled run time or overnight window ever shifts slightly. The "remove tag" step is key for keeping things tidy.

No matter which you choose, the key is to test thoroughly! Run a few dummy orders, observe how Flow processes them, and make sure everything is working exactly as you intend before letting it loose on live orders. This kind of automation is a game-changer for managing your fulfillment process and giving your customers that extra bit of flexibility. It's awesome to see the community coming together to solve these practical challenges!

Happy automating!

Share:

Use cases

Explore use cases

Agencies, store owners, enterprise — find the migration path that fits.

Explore use cases