Mechanic is a development and ecommerce automation platform for Shopify. :)
Use this task to receive immediate email notifications whenever inventory/stock levels are adjusted, whether manually or as a result of a transfer or customer order.
Runs Occurs whenever an inventory level is updated and Occurs whenever an inventory level is connected. Configuration includes email recipient, email subject, and email body.
Use this task to receive immediate email notifications whenever inventory/stock levels are adjusted, whether manually or as a result of a transfer or customer order.
Please note: Mechanic will start sending emails the second time inventory is adjusted for a particular item.
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/inventory_levels/update shopify/inventory_levels/connect
{% if event.preview %} {% capture inventory_level_json %} { "inventory_item_id": 271878346596884015, "location_id": 48752903, "available": 5 } {% endcapture %} {% assign inventory_level = inventory_level_json | parse_json %} {% endif %} {% assign cache_key = "inventory_level:" | append: inventory_level.inventory_item_id | append: "/" | append: inventory_level.location_id %} {% assign previous_available = cache[cache_key] %} {% if previous_available != nil %} {% assign available_difference = inventory_level.available | minus: previous_available %} {% if available_difference >= 0 %} {% assign available_difference = "+" | append: available_difference %} {% endif %} {% action "email" %} { "to": {{ options.email_recipient__email_required | json }}, "subject": {{ options.email_subject__required | replace: "AVAILABLE", inventory_level.available | replace: "DIFFERENCE", available_difference | strip | json }}, "body": {{ options.email_body__required_multiline | replace: "AVAILABLE", inventory_level.available | replace: "DIFFERENCE", available_difference | strip | newline_to_br | json }}, "reply_to": {{ shop.customer_email | json }}, "from_display_name": {{ shop.name | json }} } {% endaction %} {% endif %} {% action "cache" %} { "set": { "key": {{ cache_key | json }}, "value": {{ inventory_level.available }} } } {% endaction %}
DIFFERENCE inventory for {{ inventory_level.variant.sku }} {{ inventory_level.variant.product.title | default: "(Product title)" }} {% if inventory_level.variant.title != blank and inventory_level.variant.title != "Default Title" %}({{ inventory_level.variant.title }}) {% endif %}
Currently available inventory: AVAILABLE Changed by: DIFFERENCE Location: {{ inventory_level.location.name | default: "(location)" }} <a href="https://{{ shop.domain }}/admin/products/inventory/{{inventory_level.inventory_item_id}}/inventory_history?location_id={{ inventory_level.location_id }}">View inventory history</a> <a href="https://{{ shop.domain }}/admin/products/{{ inventory_level.variant.product_id }}/variants/{{ inventory_level.variant.id }}">Manage this variant</a> Thanks, {{ shop.name }}