Mechanic is a development and ecommerce automation platform for Shopify. :)
Use this task to automatically detect and tag orders that contain a complete bundle of products. Configure this task with as many bundles as you like, specifying a tag to add and a list of required SKUs.
Runs Occurs whenever an order is created. Configuration includes tags and required skus.
Use this task to automatically detect and tag orders that contain a complete bundle of products. Configure this task with as many bundles as you like, specifying a tag to add and a list of required SKUs.
Fill in "Tags and required SKUs" option with tags on the left, and a comma-delimited lists of SKUs on the right.
Mechanic is designed to benefit everybody: merchants, customers, developers, agencies, Shopifolks, 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.
(By the way, have you seen our documentation? Have you joined the Slack community?)
shopify/orders/create
{% assign tags_to_save = order.tags %} {% assign order_skus = order.line_items | map: "sku" | uniq %} {% for pair in options.tags_and_required_skus__keyval_required %} {% assign tag = pair[0] %} {% assign required_skus = pair[1] | split: "," %} {% assign matched_sku_count = 0 %} {% for order_sku in order_skus %} {% if required_skus contains order_sku %} {% assign matched_sku_count = matched_sku_count | plus: 1 %} {% endif %} {% endfor %} {% if event.preview or matched_sku_count == required_skus.size %} {% assign tags_to_save = tags_to_save | add_tag: tag %} {% endif %} {% endfor %} {% if event.preview or tags_to_save != order.tags %} { "action": { "type": "shopify", "options": [ "update", [ "order", {{ order.id | json }} ], { "tags": {{ tags_to_save | json }} } ] } } {% endif %}
{"Summer bundle"=>"SUN01,SUN02,SUN03", "Winter bundle"=>"SNOW01,SNOW02,SNOW03"}