Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
Hello!
I am trying to get a weekly sales report that shows the total orders with a value greater than 0.
I am able to get a count of all orders, but I can't figure out how to filter out orders with a value > 0.
The Flow looks like this
The Get Order Data query looks this
created_at:<='{{ scheduledAt }}' AND created_at:>'{{ scheduledAt | date_minus: "1 week" }} AND total_price:>0
The last part of the code does not seem to have any effect. I'm curious what's wrong with my query.
Koen
Solved! Go to the solution
This is an accepted solution.
The queryable fields are listed here: https://shopify.dev/docs/api/admin-graphql/2023-01/objects/QueryRoot#connection-queryroot-orders
There does not appear to be a way to query by the order amount. As a workaround for that, you could do something like:
1. Order Created
2. if order total > 100
3. Add "Over 100" tag
Note: This only affects orders going forward (but you could run it manually on past orders).
Then in your workflow, add this to the query:
tag:"Over 100"
If you need to total only orders over $100, I think the best way in a workflow to do that would be to handle it in the email body by looping over the orders and counting in liquid. Something like this code (not tested but close):
{% assign mysum = 0 %}
{% for order in getOrderData %}
{% if order.currentTotalPriceSet.shopMoney.amount > 100 %}
{% assign mysum = mysum | add: order.currentTotalPriceSet.shopMoney.amount %}
{%endif %}
{% endfor %}
{{ mysum }}
This is an accepted solution.
The queryable fields are listed here: https://shopify.dev/docs/api/admin-graphql/2023-01/objects/QueryRoot#connection-queryroot-orders
There does not appear to be a way to query by the order amount. As a workaround for that, you could do something like:
1. Order Created
2. if order total > 100
3. Add "Over 100" tag
Note: This only affects orders going forward (but you could run it manually on past orders).
Then in your workflow, add this to the query:
tag:"Over 100"
If you need to total only orders over $100, I think the best way in a workflow to do that would be to handle it in the email body by looping over the orders and counting in liquid. Something like this code (not tested but close):
{% assign mysum = 0 %}
{% for order in getOrderData %}
{% if order.currentTotalPriceSet.shopMoney.amount > 100 %}
{% assign mysum = mysum | add: order.currentTotalPriceSet.shopMoney.amount %}
{%endif %}
{% endfor %}
{{ mysum }}
Hello Paul, thanks for this workaround! It works for now, hopefully in the future the query option will be added.
2m ago Learn the essential skills to navigate the Shopify admin with confidence. T...
By Shopify Feb 12, 2025Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025