[ { "label": "Send a low stock notification when product variant inventory drops below a threshold", "trigger_type": [ "product_updated" ], "object_type": "product", "app_id": "triggers", "settings": { "priority": 0, "condition_groups": { "2": { "conditions": [ { "field": "product.inventory_quantity_changed", "settings": { "value": "true", "condition_type": "AND" }, "weight": 999 } ], "actions": [ { "type": "trigger_child_workflow", "settings": { "target_path": "product.variants", "exported_workflow": { "label": "Variant subworkflow", "trigger_type": [ "product_variant_custom" ], "object_type": "product_variant", "app_id": "triggers", "settings": { "priority": 0, "condition_groups": [ { "conditions": [ { "field": "product_variant.inventory_quantity", "settings": { "operator": "lte", "value": "12", "token_browser": "{{ Browse Tokens }}", "condition_type": "AND" }, "weight": 999 }, { "field": "product_variant.database", "settings": { "multiple": "any", "key": "reorder", "operator": "equals", "value": "FALSE", "token_browser": "{{ Browse Tokens }}", "condition_type": "AND" }, "weight": 999 } ], "actions": [ { "type": "email", "settings": { "wait": "0", "custom_wait": "", "to": "[CLICK TO EDIT]", "cc": "", "bcc": "", "reply_to": "", "subject": "Low stock alert for {{ product_variant.product.title }}: {{ product_variant.title }} ", "plain_text": "1", "body": "Total inventory for {{ product_variant.product.title }} - {{ product_variant.title }} is low. Total inventory is: {{ product_variant.inventory_quantity }}" }, "weight": 999, "target_key": "product_variant" }, { "type": "database_key_value", "settings": { "wait": "0", "custom_wait": "", "resource_type": "variants", "resource_id": "{{ product_variant.id }}", "key": "reorder", "value": "TRUE" }, "weight": 999, "target_key": "product_variant" } ] }, { "conditions": [ { "field": "product_variant.inventory_quantity", "settings": { "operator": "gt", "value": "12", "token_browser": "{{ Browse Tokens }}", "condition_type": "AND" }, "weight": 999 }, { "field": "product_variant.database", "settings": { "multiple": "any", "key": "reorder", "operator": "equals", "value": "TRUE", "token_browser": "{{ Browse Tokens }}", "condition_type": "AND" }, "weight": 999 } ], "actions": [ { "type": "database_key_value", "settings": { "wait": "0", "custom_wait": "", "resource_type": "variants", "resource_id": "{{ product_variant.id }}", "key": "reorder", "value": "FALSE" }, "weight": 999, "target_key": "product_variant" } ] }, { "conditions": [ { "field": "product_variant.database", "settings": { "multiple": "any", "key": "reorder", "operator": "empty", "value": "", "token_browser": "{{ Browse Tokens }}", "condition_type": "AND" }, "weight": 999 } ], "actions": [ { "type": "database_key_value", "settings": { "token_object_type": "product_variant", "resource_type": "variants", "resource_id": "{{ product_variant.id }}", "key": "reorder", "value": "FALSE", "wait": "0", "cw_timezone": "America\/New_York", "custom_wait": "" }, "weight": 999, "target_key": "product_variant" } ] } ] } } }, "weight": 999, "target_key": "product" } ] } }, "shared_workflow_id": 1772 }, "description": "This workflow automatically sends a low stock notification when the inventory quantity drops below a certain threshold when the product is updated. Within the sub-workflow, you can set a specific threshold that will be used to evaluate the conditions." } ]