Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
In the second step of the template (which I have changed from 2 days to 3), I want to only return orders that are unfulfilled, paid, not a test, not closed, not archived and not cancelled (i.e. truly active orders). Currently, I have only been able to get it to return unfulfilled and paid orders. How would I change the query shown to return what I need?
Solved! Go to the solution
This is an accepted solution.
Hi Scamby,
Maybe try something like this:
created_at:<='{{ scheduledAt }}' AND created_at:>'{{ scheduledAt | date_minus: "3 days" }}' AND financial_status:paid AND fulfillment_status:unfulfilled AND test:0 AND closed:0 AND cancelled:0
This query field uses the the Shopify Search API Syntax in case you need to make any more tweaks.
Hope that helps!
This is an accepted solution.
With the liquid limitations, you might have to look into something using the modulo operator, like this:
{% for order_item in getOrderData %}
{%- assign ones_column_cents = order_item.currentTotalPriceSet.shopMoney.amount | times: 100 | round | modulo: 10 -%}
{%- if ones_column_cents == 0 -%}
{% assign extra_zero = '0' -%}
{%- else -%}
{%- assign extra_zero = '' -%}
{%- endif -%}
{%- assign order_amount = order_item.currentTotalPriceSet.shopMoney.amount | append: extra_zero -%}
{{order_item.name}} - ${{order_amount}}
{% endfor %}
That worked for me on my shop at least.
Hope that helps!
This is an accepted solution.
Hi Scamby,
Maybe try something like this:
created_at:<='{{ scheduledAt }}' AND created_at:>'{{ scheduledAt | date_minus: "3 days" }}' AND financial_status:paid AND fulfillment_status:unfulfilled AND test:0 AND closed:0 AND cancelled:0
This query field uses the the Shopify Search API Syntax in case you need to make any more tweaks.
Hope that helps!
That fixed my selection issue. Now, I just need to know how to format the email it sends so that the order amount is formatted as currency. Here is what my code for the email body looks like -
The unfulfilled orders (order number - amount):
{% for order_item in getOrderData %}
{{order_item.name}} - ${{order_item.currentTotalPriceSet.shopMoney.amount}}
{% endfor %}
But in the resulting email, any orders that have a 0 in the second position after the decimal in the price look like this -
255637 - $80.4
255638 - $56.0
Round might work:
https://shopify.github.io/liquid/filters/round/
Something like:
| round: 2
No, that gave the same result.
With the liquid limitations, you might have to look into something using the modulo operator, like this:
{% for order_item in getOrderData %}
{%- assign ones_column_cents = order_item.currentTotalPriceSet.shopMoney.amount | times: 100 | round | modulo: 10 -%}
{%- if ones_column_cents == 0 -%}
{% assign extra_zero = '0' -%}
{%- else -%}
{%- assign extra_zero = '' -%}
{%- endif -%}
{%- assign order_amount = order_item.currentTotalPriceSet.shopMoney.amount | append: extra_zero -%}
{{order_item.name}} - ${{order_amount}}
{% endfor %}
That worked for me on my shop at least.
Hope that helps!
This is an accepted solution.
With the liquid limitations, you might have to look into something using the modulo operator, like this:
{% for order_item in getOrderData %}
{%- assign ones_column_cents = order_item.currentTotalPriceSet.shopMoney.amount | times: 100 | round | modulo: 10 -%}
{%- if ones_column_cents == 0 -%}
{% assign extra_zero = '0' -%}
{%- else -%}
{%- assign extra_zero = '' -%}
{%- endif -%}
{%- assign order_amount = order_item.currentTotalPriceSet.shopMoney.amount | append: extra_zero -%}
{{order_item.name}} - ${{order_amount}}
{% endfor %}
That worked for me on my shop at least.
Hope that helps!
That worked, thanks.
This is returning only orders placed within the last 3 days for me. What change to I need to make to EXCLUDE orders placed within the last 3 days?
You just change the operator on the date and remove the other created_at filter
created_at:<='{{ scheduledAt | date_minus: "3 days" }}'
unfortunately I tested many times this query and always filter order from the moment it run.
So in practice does not do what asked
This query will return all results when a filter has an error. So you have an error in your query
Hi all,
I have set up a similar flow, but the email it's producing has no data in it?
Could some please help me and explain where the flow has gone wrong?
The email has the subject and email and that's it.
Thanks!
Use have a bunch of filters in there that are not filters. And you put in values of 0 instead of false. These filters are now documented better here: https://shopify.dev/docs/api/admin-graphql/2024-10/queries/orders#argument-query-filter-test
In Canada, payment processors, like those that provide payment processing services t...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025