[ { "version": 1, "label": "Get notified through email if the price is less than cost", "trigger_type": [ "product_created", "product_updated" ], "object_type": "product", "app_id": "triggers", "settings": { "priority": 0, "condition_groups": { "1": { "conditions": { "1": { "field": "product.twig_condition", "settings": { "title": "Check if any of the price is less than cost value", "value": "{% for product_variant in product.variants %}\r\n{% set cost_obj = load('inventory_item',product_variant.inventory_item_id ) %}\r\n{% if cost_obj[\"cost\"] > product_variant.price %}\r\ntrue\r\n{% endif %}\r\n{% endfor %}\r\n", "token_object_type": "product", "condition_type": "AND" }, "weight": 999 } }, "actions": { "1": { "type": "email", "settings": { "token_object_type": "product", "to": "{{ shop.email }}", "cc": "", "bcc": "", "reply_to": "", "subject": "Price alert for: {{ product.title }}", "plain_text": "0", "body": "The cost price for {{ product.title }} is higher than the selling price.\r\n{% for product_variant in product.variants %}\r\n{{product_variant.title}} Price: {{product_variant.price}}\r\n{% endfor %}\r\n", "purpose": "transactional", "wait": "0", "cw_timezone": "America\/Los_Angeles", "custom_wait": "", "run_once": 0 }, "weight": 999, "target_key": "product" } } } } }, "description": "Whenever a product is created or modified, this automation is triggered to examine whether any of the variant prices have been lowered below the cost, and it sends an email to a predetermined recipient. This automation is extremely beneficial in guaranteeing that you do not accidentally sell at a loss." } ]