[ { "version": 1, "label": "When only one item remains in stock, set a product metafield to \"Last One!\"", "trigger_type": [ "product_created", "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": "equals", "value": "1" }, "weight": 999 } ], "actions": [ { "type": "product_set_metafield_value", "settings": { "wait": "0", "custom_wait": "", "namespace": "arigato", "key": "last_one", "value_type": "string", "value": "Last One!" }, "weight": 999, "target_key": null } ] }, { "conditions": [ { "field": "product.inventory_quantity_changed", "settings": { "value": "true" }, "weight": 999 }, { "field": "product.inventory_quantity", "settings": { "operator": "gt", "value": "1" }, "weight": 999 }, { "field": "product.metafields", "settings": { "multiple": "any", "namespace": "arigato", "key": "last_one", "operator": "not_empty", "value": "" }, "weight": 999 } ], "actions": [ { "type": "product_set_metafield_value", "settings": { "wait": "0", "custom_wait": "", "namespace": "arigato", "key": "last_one", "value_type": "string", "value": "" }, "weight": 999, "target_key": null } ] } ], "subtopic": null, "source": "library" }, "description": "This automation is fired every time a product is sold or updated. It checks for the available inventory quantity and if it's equal to 1, it sets the metafield value to \"Last One\"" } ]