[ { "label": "Publish a product when restocked and unpublish when the product runs out of stock", "trigger_type": [ "product_updated", "product_created" ], "object_type": "product", "app_id": "triggers", "settings": { "priority": 0, "condition_groups": { "1": { "conditions": { "1": { "field": "product.inventory_quantity", "settings": { "operator": "gt", "value": "0", "token_browser": "{{ Browse Tokens }}", "token_object_type": "product", "condition_type": "AND" }, "weight": 10 }, "2": { "field": "product.database", "settings": { "multiple": "any", "key": "in_stock", "operator": "equals", "value": "false", "token_object_type": "product", "condition_type": "AND" }, "weight": 20 } }, "actions": { "1": { "type": "product_publish", "settings": { "token_object_type": "product", "publish_on": "", "wait": "0", "cw_timezone": "Europe\/Lisbon", "custom_wait": "" }, "weight": 999, "target_key": "product" }, "2": { "type": "product_set_database", "settings": { "token_object_type": "product", "key": "in_stock", "value": "true", "wait": "0", "cw_timezone": "Europe\/Lisbon", "custom_wait": "" }, "weight": 1009, "target_key": "product" } } }, "2": { "conditions": { "1": { "field": "product.inventory_quantity", "settings": { "operator": "lte", "value": "0", "token_browser": "{{ Browse Tokens }}", "token_object_type": "product", "condition_type": "AND" }, "weight": 60 }, "2": { "field": "product.database", "settings": { "multiple": "any", "key": "in_stock", "operator": "equals", "value": "true", "token_browser": "{{ Browse Tokens }}", "token_object_type": "product", "condition_type": "AND" }, "weight": 70 } }, "actions": { "1": { "type": "database_key_value", "settings": { "wait": "0", "custom_wait": "", "resource_type": "products", "resource_id": "{{ product.id }}", "key": "in_stock", "value": "false", "token_object_type": "product" }, "weight": 80, "target_key": "product" }, "2": { "type": "product_unpublish", "settings": { "token_object_type": "product", "update_status": 1, "status": "draft", "wait": "0", "cw_timezone": "Europe\/Lisbon", "custom_wait": "" }, "weight": 90, "target_key": "product" } } } }, "shared_workflow_id": 109221 }, "description": "The automation is fired every time a product is updated. If the inventory level goes below zero, the workflow unpublished the product setting the status to draft. When the product is restocked, the workflow fires and publishes the product. " } ]