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?
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
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!
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
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
This query will return all results when a filter has an error. So you have an error in your query


