Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
I have an online bookshop where we would like to announce when a book has just been published. Each book (product) has a custom metafield which describes the book's publication date - custom.book_publication_date. It has the format YYYY-MM-DD.
I would like to create a Shopify flow script whereby:
- all products are looked at each day
- if the custom.book_publication_date is equal to today then tag the product "published today".
- if the custom.book_publication_date is not equal to today then remove the "published today" tag.
- if the custom.book_publication_date minus today is equal to or less than 7 then tag the product "published this week".
- if the custom.book_publication_date minus today is greater than 7 then remove the "published this week" tag.
I will then create a smart collection based on these tags.
Can anyone help please?
Ignore the other response. It's an AI-bot spitting out non-sense.
You shouldn't try to load all your products every day - that's a big waste of resources and could cause you to hit API limits.
I think you want something like:
Scheduled time trigger
Get product data
For each (product)
...
In the "Get product data", you'll need to filter by the metafield value. That metafield needs to have "filterable" turned on in setting to make it usable as a search filter.
The general syntax for a metafields filter is:
metafields.custom.book_publication_date:"2025-05-21"
As documented here:
That said, I'm not sure if you can filter by dates just yet. You'll need to try it and see if it works.
Thanks for the detailed respoinse!
I am going to update the flow so that it adds the tag if:
- custom.book_publication_date minus today's date is equal to or less than 30 (ie the book is published in the last 30 days).
I have the following set up, but I suspect that the formula I;ve entered in the condition is incorrect:
- {{ "now" | date: "%Y-%m-%d" }}-custom.book_publication_date<=30
Any ideas on how to write formulas in conditions?
Conditions do not currently accept liquid in the value field. If you need to do date math in a condition, you'll need to use a run code step before the condition. One problem with that is that Flow currently does not allow Run code inside For each loops. But I'm not sure the way you are doing this is the right way. What products are you getting and why not use that shop metafield in your query for "Get product data"?
Thanks @paul_n .
I think you're right, I will try and Advanced query in the Get product data step.
Do you know how to write a query that checks if the product has a custom.book_publication_date minus today's date is <= 30?
Part of the challenge might be converting custom.book_publication_date from string to a value?
Thanks!
I'm not sure you query by if a date value is < or >. If you could, something like this:
metafields.custom.book_publication_date:>{{ scheduledAt | date_minus:"30 days" }}
You might instead need to query by if it matches the exact date.
June brought summer energy to our community. Members jumped in with solutions, clicked ...
By JasonH Jun 5, 2025Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025