[ { "label": "Send a list of all pending orders every day at 00:05am", "trigger_type": [ "order_custom" ], "object_type": "order", "app_id": "triggers", "settings": { "priority": 0, "condition_groups": { "1": { "conditions": [], "actions": { "1": { "type": "custom", "settings": { "wait": "0", "custom_wait": "", "label": "Check for all pending orders. ", "twig": "{% set pending_orders = [] %}\r\n{% set orders = RUN_ACTION('shopify_api_request',{\r\n method: \"GET\",\r\n path: \"orders\",\r\n data: {limit: 50,financial_status:'paid',tags:'-ordered,-refunded'},\r\n format: \"order\",\r\n}) %}\r\n\r\n{% if orders.response|length > 0 %}\r\n{% set message = \"There are currently \"~orders.response|length~\" pending order(s) \\n\" %}\r\n{% for order in orders.response %}\r\n{{order|debug}}\r\n{% set message = message~\" \"~shopify_admin_link(order, {resource: 'orders', format: 'html', title: null})~\"\\n\" %}\r\n{% endfor %}\r\n\r\n{% set email_response = QUEUE_ACTION('email',{\r\n to: shop.email,\r\n subject: \"Pending Orders List\",\r\n body:message,\r\n plain_text: false,\r\n context: {order: order}\r\n}) %}\r\n\r\n{% endif %}\r\n", "token_object_type": "order" }, "weight": 999, "target_key": "order" } } } }, "shared_workflow_id": 36889 }, "description": "Using a batch workflow, this automation will compile a daily list of pending orders and email them to them to the store's email." } ]