[ { "label": "Send an email notification when a product price changes", "trigger_type": [ "product_updated" ], "object_type": "product", "app_id": "triggers", "settings": { "priority": 0, "condition_groups": { "1": { "conditions": { "1": { "field": "product.twig_condition", "settings": { "title": "Check if the price has changed", "value": "{% for product_variant in product.variants if product_variant.price!=product_variant.database.current_price %}\r\n true\r\n{% endfor %}", "token_object_type": "product", "condition_type": "AND" }, "weight": 999 } }, "actions": { "2": { "type": "email", "settings": { "token_object_type": "product", "to": "{{shop.email}}", "cc": "", "bcc": "", "reply_to": "", "subject": "Price change notice for {{product.title}}", "plain_text": "1", "body": "Hi, \r\n\r\nPlease note a price change for {{product.title}}\r\n\r\nPrice change details: \r\n{% for product_variant in product.variants if product_variant.price!=product_variant.current_price %}\r\n {{product_variant.title}} Price change from {{product_variant.database.current_price}} to {{ product_variant.price }}\r\n{% endfor %}\r\n\r\nRegards", "wait": "0", "cw_timezone": "Australia\/Melbourne", "custom_wait": "", "run_once": 0 }, "weight": 1009, "target_key": "product" }, "3": { "type": "custom", "settings": { "token_object_type": "product", "label": "Update the database value with the update price. ", "twig": "{% for product_variant in product.variants if product_variant.price!= product_variant.database.current_price %}\r\n {% set result = RUN_ACTION('set_database',{\r\n resource:product_variant,\r\n key: \"current_price\",\r\n value: product_variant.price\r\n }) %}\r\n{% endfor %}\r\n", "wait": "0", "cw_timezone": "Australia\/Melbourne", "custom_wait": "" }, "weight": 1019, "target_key": "product" } } } }, "shared_workflow_id": 56209 }, "description": "This automation will monitor changes in the product prices by keeping a database value and comparing it with the prices every time the product is updated. " } ]