Daily Email on OOS Products Flow Suddenly Stopped Reading From a Location?

Topic summary

A Shopify Flow automation that sends daily emails about out-of-stock (OOS) products stopped working correctly. Initially, the user believed it was only reading from the default location instead of all locations, but later clarified the flow was returning zero items daily.

Root Issue Identified:
The query syntax in the “Get product data” action was invalid. The original query used date_minus:"one day" incorrectly.

Solution:

  • Changed query from tag:Retail OOS AND date_minus:"one day" to tag:"Retail OOS" AND created_at:>{{ scheduledAt | date_minus:"24 hours"}}
  • The date_minus filter only accepts plural time units (seconds, minutes, hours, days, weeks, months, years), not singular “one day”
  • Using “24 hours” instead of “one day” resolved the Liquid error

Current Status:
The flow now returns results (1 item on test run). User is monitoring for 24 hours to verify consistent functionality. A related issue with another flow not properly adding/removing OOS tags by location was also mentioned, which may affect overall results.

Summarized with AI on October 27. AI used: claude-sonnet-4-5-20250929.

We have been using the flow template to send us daily e-mails in regards to out of stock products. For some reason, sometime within the last week, it has started only e-mailing us products from our default location, not both locations that we currently use.

We haven’t changed anything about the flow, so I’m confused on why it would suddenly stop including our POS items from our daily e-mail blast.

→ Scheduled every day at 9 a.m CST

Then do this: Query: updated_at:<=‘{{ scheduledAt }}’ AND updated_at:>‘{{ scheduledAt | date_minus: “1 day” }}’
inventory_total:<=0 (sort by created in ascending order)

Then do this: Count (getProductData)

Then Send internal e-mail:

Items out of stock:
{% for getProductData_item in getProductData %}

  • {{getProductData_item.title}}
    {% for variant_item in getProductData_item.variants %}
  • {{ variant_item.sku }} - {{ variant_item.title }} - {{ variant_item.inventoryQuantity }}
    {% endfor %}
    {% endfor %}

Am I missing something that would make it suddenly disregard our POS Location, or is there a specific Shopify setting that may have affected this recently?

1 Like

Usually when behavior changes someone in your shop changed something (either in Flow or a setting like inventory tracking). It’s also possible the API changed somehow (I’m not aware of anything). Flow also recently updated to use the 2024-07 API, (from 2024-04), but I’m not aware of any changes to the Product query as part of that. But the timeline doesn’t align with your timeline.

If you think there is an issue it would help to show the current inventory for a product and the output of the above code for that product

Sorry for the delayed response! It looks like I was wrong.

The issue isn’t the locations, the issue is that it’s reporting items that have been out of stock for a while, not the most recent.

How would I adjust it so it only includes the most recent OOS items?

Hi Paul - I have attached screenshots of our actual flow. Is there anything you can see which might cause our issue? It’s returning 0 items every day.

Your query is not a valid query in Get product data.

You have:
tag:Retail OOS AND date_minus:"one day" }}

Try something like this:
tag:"Retail OOS" AND created_at:>{{ scheduledAt | date_minus:"one day"}}

The one day is based on going OOS over the last 24 hours - wouldn’t the query you suggested take everything that was created in the last 24 hours?

Yes, you cannot check for tags added in the last day.

I will adjust the flow to your suggestion and reach back out tomorrow to see if anything has changed - thank you!

When it was supposed to run this morning it returned the error: Liquid error: invalid duration provided to date_minus

need to see your liquid.

What part of it? Can I consolidate it at all and attach?

The code that has date_minus in it

While looking through liquid - what section would it be under?

Your workflow is custom to you. I don’t know what it contains or where you might have put the code that led to that message.

I’m looking around to find the data you’re looking for, but I guess I’m just either misunderstanding or just not capable of finding it. I’m going to keep looking into it and hopefully I can find it, but any other info you can provide to hep me provide you with that answer would be helpful!

Your workflow run, which presumably told you the error, should’ve happened on the step that had that text/code.

The only place I saw the error was just on the Flow page. So I don’t know where to find the actual code you’re requesting to find the resolution.

It’s on the “Get product data” action. So what’s in that configuration?

Oh I’m sorry, I thought I already attached that screenshot to you. I’ve attached it here!

One thing…I think you need quotes around that date so:

created_at:>“{{ scheduledAt | date_minus:“one day”}}”

If that doesn’t work DM me a link to the workflow so I can check it out in more detail