Low stock emails through Shopify flow for specific products or at category level

Hello, Shopify Community!

I’m seeking assistance with a Shopify Flow workflow I’ve created. I’ve been working with a Shopify Support Advisor, Ron, and he recommended posting here to get some expert help.

My goal is to create a single daily or weekly email report that lists all products from a specific collection that have an inventory level below 10 units.

Here’s my current situation:

Workflow Name: Send Daily Christmas Under 10 Email

Trigger: The trigger is correctly set up to check for inventory levels.

The Challenge: I need to add a condition to this workflow to filter the report so it only includes products from my “Christmas” collection (which has ID: 280120230044). The products in this collection all have an SKU that starts with “XM”.

I tried using a condition based on the product collection, but I keep getting a “condition was false” error, or the report includes all products under 10 units instead of just the ones from the specified collection.

Could an experienced Flow user or developer please help me find the correct condition to use? I’ve attached screenshots of my current workflow below.

Thank you so much for your help!

Hi! It seems screenshots weren’t attached :slight_smile:

FYI, this is the developer support community. The merchant support community is over here:

Hey @Tara_Capp

As Paul mentioned this is the Shopify Developer Forum, I’d recommend posting future issues in Shopify Flow - Shopify Community which is designed for merchants such as yourself.

I’ve created you two flow options here. You will need to open notepad, copy the code in below and save each as a <name>.flowfile as I cannot upload them here.

The first checks daily at 8am UK time for product variants with less than 10 units and in your collection. You should update the email to be the right email address.

b9a9d10cfe3f3b3449cf9376b4694ab9aef824b5fb56fad317819589767ec2fe:{"__metadata":{"version":0.1},"root":{"steps":[{"step_id":"ededed10-a4ee-11f0-8be6-8116c9f91f9b","step_position":[-800,-60],"config_field_values":[{"config_field_id":"recurrence","value":"[\"DTSTART;TZID=Europe/London:20251009T080000\\nRRULE:FREQ=DAILY;INTERVAL=1;WKST=MO\"]"}],"task_id":"shopify::flow::scheduled_time","task_version":"0.1","task_type":"TRIGGER","description":null,"note":null,"name":null},{"step_id":"9b2f9050-a4ef-11f0-8be6-8116c9f91f9b","step_position":[540,-40],"config_field_values":[{"config_field_id":"address","value":"tara@truly.co.uk"},{"config_field_id":"subject","value":"Low Stock Christmas Products"},{"config_field_id":"message","value":"The following {{runCode.length}} products have less than 10 units available:\n\n<ul>\n{% for item in getProductVariantData %}\n  <li>\n<a href=\"https://{{shop.myshopifyDomain}}/products/{{item.product.legacyResourceId}}/variants/{{item.legacyResourceId}}\">{{item.title}}</a>\n</li>\n{% endfor %}\n</ul>"}],"task_id":"shopify::flow::send_email","task_version":"0.1","task_type":"ACTION","description":null,"note":null,"name":null},{"step_id":"32d49980-a4f2-11f0-bd74-6dda38a122e3","step_position":[-120,-40],"config_field_values":[{"config_field_id":"input","value":"query{\n  getProductVariantData {\n    id\n  }\n}"},{"config_field_id":"script","value":"export default function main(input) {\n  return {\n    length: input.getProductVariantData.length,\n  }\n}"},{"config_field_id":"output_schema","value":"\"The output of Run Code\"\ntype Output {\n  \"The number of items returned get product data query\"\n  length: Int!\n}"}],"task_id":"shopify::flow::run_code","task_version":"0.1","task_type":"ACTION","description":"Calculate the number of results","note":null,"name":"Run code"},{"step_id":"61337ad0-a4f2-11f0-bd74-6dda38a122e3","step_position":[180,-40],"config_field_values":[{"config_field_id":"condition","value":"{\"uuid\":\"64187252-a4f2-11f0-bd74-6dda38a122e3\",\"lhs\":{\"uuid\":\"62986200-a4f2-11f0-bd74-6dda38a122e3\",\"parent_uuid\":\"64187252-a4f2-11f0-bd74-6dda38a122e3\",\"lhs\":{\"uuid\":\"64187250-a4f2-11f0-bd74-6dda38a122e3\",\"parent_uuid\":\"62986200-a4f2-11f0-bd74-6dda38a122e3\",\"value\":\"runCode.length\",\"comparison_value_type\":\"EnvironmentValue\",\"full_environment_path\":\"runCode.length\"},\"rhs\":{\"uuid\":\"6631dc70-a4f2-11f0-bd74-6dda38a122e3\",\"parent_uuid\":\"62986200-a4f2-11f0-bd74-6dda38a122e3\",\"value\":\"0\",\"comparison_value_type\":\"LiteralValue\"},\"value_type\":\"EnvironmentScalarDefinition:Int\",\"operator\":\">\",\"operation_type\":\"Comparison\"},\"operator\":\"AND\",\"operation_type\":\"LogicalExpression\"}"}],"task_id":"shopify::flow::condition","task_version":"0.1","task_type":"CONDITION","description":null,"note":null,"name":null},{"step_id":"95941ca0-a4f5-11f0-8d7b-4f3b63bbbfda","step_position":[-460,-60],"config_field_values":[{"config_field_id":"sort_by","value":"{\"sortKey\":\"INVENTORY_QUANTITY\",\"order\":\"ASCENDING\"}"},{"config_field_id":"max_root_records","value":"100"},{"config_field_id":"query","value":"inventory_quantity:<10 AND collection:280120230044"}],"task_id":"shopify::flow::fetch::product_variants","task_version":"v1","task_type":"ACTION","description":null,"note":null,"name":"Get product variant data"}],"links":[{"from_step_id":"32d49980-a4f2-11f0-bd74-6dda38a122e3","from_port_id":"output","to_step_id":"61337ad0-a4f2-11f0-bd74-6dda38a122e3","to_port_id":"input"},{"from_step_id":"61337ad0-a4f2-11f0-bd74-6dda38a122e3","from_port_id":"true","to_step_id":"9b2f9050-a4ef-11f0-8be6-8116c9f91f9b","to_port_id":"input"},{"from_step_id":"ededed10-a4ee-11f0-8be6-8116c9f91f9b","from_port_id":"output","to_step_id":"95941ca0-a4f5-11f0-8d7b-4f3b63bbbfda","to_port_id":"input"},{"from_step_id":"95941ca0-a4f5-11f0-8d7b-4f3b63bbbfda","from_port_id":"output","to_step_id":"32d49980-a4f2-11f0-bd74-6dda38a122e3","to_port_id":"input"}],"patched_fields":[],"variables":[],"note":null,"workflow_name":"Daily Low Stock Email"}}

The second option, will be triggered whenever the stock is low so you’ll get “real time” alerts when product variants drop below 10.
You will need to update the collection and email address in this one.

5c160a3ab5722ae9ff5b57c119d658cae10813e99471bb8b9a1d14e1f7e9b8bf:{"__metadata":{"version":0.1},"root":{"steps":[{"step_id":"7698b130-a4f0-11f0-8be6-8116c9f91f9b","step_position":[0,0],"config_field_values":[],"task_id":"shopify::admin::inventory_quantity_changed","task_version":"0.1","task_type":"TRIGGER","description":null,"note":null,"name":null},{"step_id":"7a11f970-a4f0-11f0-8be6-8116c9f91f9b","step_position":[360,0],"config_field_values":[{"config_field_id":"condition","value":"{\"uuid\":\"8efbd362-a4f0-11f0-8be6-8116c9f91f9b\",\"lhs\":{\"uuid\":\"86ff9b10-a4f0-11f0-8be6-8116c9f91f9b\",\"parent_uuid\":\"8efbd362-a4f0-11f0-8be6-8116c9f91f9b\",\"array_path\":{\"uuid\":\"86ff9b11-a4f0-11f0-8be6-8116c9f91f9b\",\"parent_uuid\":\"86ff9b10-a4f0-11f0-8be6-8116c9f91f9b\",\"value\":\"product.collections\",\"comparison_value_type\":\"EnvironmentValue\"},\"array_item_key\":{\"uuid\":\"86ff9b12-a4f0-11f0-8be6-8116c9f91f9b\",\"parent_uuid\":\"86ff9b10-a4f0-11f0-8be6-8116c9f91f9b\",\"value\":\"collections_item\",\"comparison_value_type\":\"EnvironmentValue\"},\"operation\":{\"uuid\":\"86ff9b13-a4f0-11f0-8be6-8116c9f91f9b\",\"parent_uuid\":\"86ff9b10-a4f0-11f0-8be6-8116c9f91f9b\",\"lhs\":{\"uuid\":\"86ff9b14-a4f0-11f0-8be6-8116c9f91f9b\",\"parent_uuid\":\"86ff9b13-a4f0-11f0-8be6-8116c9f91f9b\",\"lhs\":{\"uuid\":\"86ff9b15-a4f0-11f0-8be6-8116c9f91f9b\",\"parent_uuid\":\"86ff9b14-a4f0-11f0-8be6-8116c9f91f9b\",\"value\":\"collections_item.id\",\"comparison_value_type\":\"EnvironmentValue\",\"full_environment_path\":\"collections_item.id\"},\"rhs\":{\"uuid\":\"94dc21d0-a4f6-11f0-8d7b-4f3b63bbbfda\",\"parent_uuid\":\"86ff9b14-a4f0-11f0-8be6-8116c9f91f9b\",\"value\":\"gid://shopify/Collection/280120230044\",\"comparison_value_type\":\"LiteralValue\"},\"value_type\":\"EnvironmentScalarDefinition:ID\",\"operator\":\"==\",\"operation_type\":\"Comparison\"},\"operator\":\"AND\",\"operation_type\":\"LogicalExpression\"},\"operator\":\"ANY\",\"operation_type\":\"ArrayExpression\"},\"rhs\":{\"uuid\":\"8b3fdcd0-a4f0-11f0-8be6-8116c9f91f9b\",\"parent_uuid\":\"8efbd362-a4f0-11f0-8be6-8116c9f91f9b\",\"lhs\":{\"uuid\":\"8efbd360-a4f0-11f0-8be6-8116c9f91f9b\",\"parent_uuid\":\"8b3fdcd0-a4f0-11f0-8be6-8116c9f91f9b\",\"value\":\"productVariant.inventoryQuantity\",\"comparison_value_type\":\"EnvironmentValue\",\"full_environment_path\":\"productVariant.inventoryQuantity\"},\"rhs\":{\"uuid\":\"92678710-a4f0-11f0-8be6-8116c9f91f9b\",\"parent_uuid\":\"8b3fdcd0-a4f0-11f0-8be6-8116c9f91f9b\",\"value\":\"10\",\"comparison_value_type\":\"LiteralValue\"},\"value_type\":\"EnvironmentScalarDefinition:Int\",\"operator\":\"<\",\"operation_type\":\"Comparison\"},\"operator\":\"AND\",\"operation_type\":\"LogicalExpression\"}"}],"task_id":"shopify::flow::condition","task_version":"0.1","task_type":"CONDITION","description":null,"note":null,"name":null},{"step_id":"9904f2b0-a4f0-11f0-8be6-8116c9f91f9b","step_position":[720,0],"config_field_values":[{"config_field_id":"address","value":"tara@truly.co.uk"},{"config_field_id":"subject","value":"Low Stock Christmas Product Alert"},{"config_field_id":"message","value":"The following product has less than 10 units available:\n\n<a href=\"https://{{shop.myshopifyDomain}}/admin/products/{{product.legacyResourceId}}\">{{product.title}}</a>"}],"task_id":"shopify::flow::send_email","task_version":"0.1","task_type":"ACTION","description":null,"note":null,"name":null}],"links":[{"from_step_id":"7698b130-a4f0-11f0-8be6-8116c9f91f9b","from_port_id":"output","to_step_id":"7a11f970-a4f0-11f0-8be6-8116c9f91f9b","to_port_id":"input"},{"from_step_id":"7a11f970-a4f0-11f0-8be6-8116c9f91f9b","from_port_id":"true","to_step_id":"9904f2b0-a4f0-11f0-8be6-8116c9f91f9b","to_port_id":"input"}],"patched_fields":[],"variables":[],"note":null,"workflow_name":"Low Stock Christmas Alerts"}}