Tags: Auto-Update, Delivery, Metafields, Variants
Use this task to automatically add variants to the configured delivery profile on product update, if any of the variants have a metafield value matching the configured value. Conversely, variants with a non-existant or mismatched metafield value that are in the configured delivery profile will be removed.
- View in the task library: tasks.mechanic.dev/auto-associate-variants-with-a-delivery-profile-by-metafield-value
- Task JSON, for direct import: task.json
- Preview task code: script.liquid
{
"metafield_namespace_and_key__required": null,
"metafield_value_to_match__required": null,
"delivery_profile_id__required_number": null
}
Learn about task options in Mechanic
shopify/products/update
mechanic/user/trigger
Learn about event subscriptions in Mechanic
Use this task to automatically add variants to the configured delivery profile on product update, if any of the variants have a metafield value matching the configured value. Conversely, variants with a non-existant or mismatched metafield value that are in the configured delivery profile will be removed.
Configure this task with a variant metafield namespace and key separated by a period (e.g. "custom.my_metafield"), the metafield value to match, and the delivery profile ID. Find the delivery profile ID by navigating to the "Shipping and delivery" section of your Shopify settings, and clicking on the "Manage " link of the delivery profile you want to use. The delivery profile ID is the series of numbers at the very end of the URL – if the URL is admin.shopify.com/store/{your_shop}/settings/shipping/profiles/12345, then the delivery profile ID is 123545.
As an initial setup, you can run the task manually to have it review all of the variants in your shop.
Find this task in the library at tasks.mechanic.dev, and use the "Try this task" button. Or, import this task's JSON export – see Importing and exporting tasks to learn how imports work.
Found a bug? Got an improvement to add? Start here: ../../CONTRIBUTING.md.
Submit your task requests for consideration by the Mechanic community, and they may be chosen for development and inclusion in the task library!