Skip to content

Latest commit

 

History

History

add-option-names-as-variant-metafields-for-in-stock-variants

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Add Option Name as a Variant Metafield for In Stock Variants

Tags: In stock, Metafields, Online Store 2.0, Variants

This task populates variant metafields with your desired variant options for use by Online Store 2.0 filtering, taking into account whether or not a variant has inventory available for sale online. It runs when inventory levels are updated, and may also be run manually to scan all variants in your shop.

Default options

{
  "metafield_namespace__required": null,
  "option_names_and_metafield_keys__keyval_required": null
}

Learn about task options in Mechanic

Subscriptions

shopify/inventory_levels/update
mechanic/user/trigger
mechanic/shopify/bulk_operation

Learn about event subscriptions in Mechanic

Documentation

This task populates variant metafields with your desired variant options for use by Online Store 2.0 filtering, taking into account whether or not a variant has inventory available for sale online. It runs when inventory levels are updated, and may also be run manually to scan all variants in your shop.

Configure it with a single metafield namespace (e.g. "my_fields") and one or more variant options (e.g. "Size") paired with their respective metafield key (e.g. "size_in_stock").

Important: To use OS 2.0 collection and search filtering, you must configure variant metafield definitions prior to configuring and enabling this task. Read Shopify's documenation on how to Add storefront filtering for more info.

Installing this task

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.

Contributions

Found a bug? Got an improvement to add? Start here: ../../CONTRIBUTING.md.

Task requests

Submit your task requests for consideration by the Mechanic community, and they may be chosen for development and inclusion in the task library!