Include metafields in Shopify webhook events
Include Shopify metafields in webhook event payloads, and optionally filter by metafield values, using Mechanic custom Shopify webhooks.
1
2
3
4
Subscribe a task to the Mechanic topic
user/products/tracked_update{% assign tracked_by_mechanic = false %}
{% for metafield in product.metafields %}
{% if metafield.namespace == "custom" and metafield.key == "track_with_mechanic" %}
{% assign tracked_by_mechanic = metafield.value %}
{% endif %}
{% endfor %}
{% log
topic: event.topic,
shopify_topic: event.shopify_topic,
product_id: product.id,
tracked_by_mechanic: tracked_by_mechanic
%}Related
Last updated
Was this helpful?