Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
I need to create a shopify flow such that:
- When a product is deleted or archived
- Search through all paid orders that are either unfulfilled or partially fulfilled that have the deleted sku as an unfulfilled line item
- send a slack message with a list of these orders to a slack channel
I have tried the following:
- created a flow with the trigger inventory item deleted
- used this advance query
{
orders(first: 100, query: "status:open fulfillment_status:(fulfilled OR partial) line_items.product_id:{{inventoryItemId}}") {
edges {
node {
id
name
createdAt
fulfillmentStatus
lineItems(first: 100) {
edges {
node {
id
title
quantity
}
}
}
}
}
}
}
- used the send slack message action with this message:
An product {{inventoryItemId}} has been deleted and the following orders are affected:
{% for getOrderData_item in getOrderData %}
{{getOrderData_item.name}}
{% endfor %}
{% for getOrderData_item in getOrderData %}
{{getOrderData_item.customer.email}}
{% endfor %}
- My output however excludes the order data, this is what I get
This part of your query is not valid:
line_items.product_id:{{inventoryItemId}}
The available query fields are here:
https://shopify.dev/docs/api/admin-graphql/2023-01/objects/QueryRoot#connection-queryroot-orders
You can query by sku got find order that match the lineIitems. I hightly recommend you do this query in a something like postman first to make sure you are getting what you expect. The API will currently return all results if you include invalid filters, so testing it up front helps a lot.
FWIW, I think this is only solvable by using queries.
Shopify and our financial partners regularly review and update verification requiremen...
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