Mechanic is a development platform for Shopify. :)
This task will monitor incoming orders for any products that are included in the collection you choose. [Learn where to find the collection ID.](https://help.usemechanic.com/articles/2946120-how-do-i-find-an-id-for-a-product-collection-order-or-something-else)
Runs when an order is paid. Configuration includes required collection, email address, email subject, and email body.
This task will monitor incoming orders for any products that are included in the collection you choose. Learn where to find the collection ID.
Please note: This task does not determine what collection the customer may have been browsing when they added the product to the cart. This task simply checks to see which collections contain each purchased product, looking for a match with the collection you choose.
Mechanic is designed to benefit everybody: merchants, customers, developers, agencies, Gurus, everybody.
That’s why we make it easy to configure automation without code, why we make it easy to tweak the underlying code once tasks are installed, and why we publish it all here for everyone to learn from.
{% assign qualifying_line_item_titles = array %} {% for line_item in order.line_items %} {% if line_item.product_id %} {% assign line_item_collection_ids = line_item.product.collects | map: "collection_id" %} {% if line_item_collection_ids contains options.required_collection_id__number_required %} {% assign qualifying_line_item_titles[qualifying_line_item_titles.size] = line_item.title %} {% endif %} {% endif %} {% endfor %} {% if event.preview or qualifying_line_item_titles != empty %} {% assign line_item_titles = qualifying_line_item_titles | uniq | join: ", " %} {% assign collection_title = shop.collections[options.required_collection_id__number_required].title %} {% if event.preview %} {% assign line_item_titles = "(products)" %} {% assign collection_title = "(collection)" %} {% endif %} {% action "email" %} { "to": {{ options.email_address__required | json }}, "subject": {{ options.email_subject__required | replace: "COLLECTION_TITLE", collection_title | replace: "LINE_ITEM_TITLES", line_item_titles | json }}, "body": {{ options.email_body__multiline_required | replace: "COLLECTION_TITLE", collection_title | replace: "LINE_ITEM_TITLES", line_item_titles | strip | newline_to_br | json }}, "from_display_name": {{ shop.name | json }} } {% endaction %} {% endif %}
New purchase for LINE_ITEM_TITLES, from COLLECTION_TITLE
Hello, Order {{ order.name }} includes LINE_ITEM_TITLES, from COLLECTION_TITLE. <a href="https://{{ shop.domain }}/admin/orders/{{ order.id }}">Manage this order in Shopify</a> Thanks, -Mechanic, for {{ shop.name }}