[ { "version": 1, "label": "Set a metafield value when a product is sold out", "trigger_type": [ "product_updated" ], "object_type": "product", "app_id": "triggers", "settings": { "priority": 0, "condition_groups": [ { "conditions": [ { "field": "product.inventory_quantity_changed", "settings": { "value": "true" }, "weight": 999 }, { "field": "product.inventory_quantity", "settings": { "operator": "lte", "value": "0" }, "weight": 999 } ], "actions": [ { "type": "product_set_metafield_value", "settings": { "wait": "0", "custom_wait": "", "namespace": "arigato", "key": "sold_out", "value_type": "integer", "value": "1" }, "weight": 999, "target_key": "product" } ] }, { "conditions": [ { "field": "product.inventory_quantity_changed", "settings": { "value": "true" }, "weight": 999 }, { "field": "product.inventory_quantity", "settings": { "operator": "gt", "value": "0" }, "weight": 999 }, { "field": "product.metafields", "settings": { "multiple": "any", "namespace": "arigato", "key": "sold_out", "operator": "equals", "value": "1", "condition_type": "AND" }, "weight": 999 } ], "actions": [ { "type": "product_set_metafield_value", "settings": { "wait": "0", "custom_wait": "", "namespace": "arigato", "key": "sold_out", "value_type": "integer", "value": "0" }, "weight": 999, "target_key": "product" } ] } ] }, "description": "This automation is fired every time a product is updated or sold out. The workflow checks on the current inventory level, and if the level hits zero, it sets the product metafield value to sold out." } ]