Skip to content

Latest commit

 

History

History

copy-prefixed-tags-to-metafields

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Copy prefixed tags to metafields

Tags: Customers, Metafields, Online Store 2.0, Orders, Products, Tag

Use this task to copy prefixed tags to metafields, useful for Online Store 2.0 filtering. When run manually, it will scan for all of the object type you have configured in the task, and add/update the configured metafield on each with the resulting tag value when the tag prefix is matched.

Default options

{
  "shopify_object_type__required": null,
  "metafield_namespace__required": null,
  "metafield_key__required": null,
  "metafield_type__required": null,
  "tag_prefix__required": null
}

Learn about task options in Mechanic

Subscriptions

mechanic/user/trigger

Learn about event subscriptions in Mechanic

Documentation

Use this task to copy prefixed tags to metafields, useful for Online Store 2.0 filtering. When run manually, it will scan for all of the object type you have configured in the task, and add/update the configured metafield on each with the resulting tag value when the tag prefix is matched.

This task supports the customer, order, and product Shopify object types, and the following Shopify metafield types: boolean, date, date_time, number_decimal, number_integer, and single_line_text_field. The tag prefix should include any existing demarcation (e.g. spaces, dashes, colons) from the tag value.

By example:

  • Object type: "product"
  • Metafield type: "date"
  • Tag prefix: "Release Date: "
  • Product tag: "Release Date: 2022-04-01"
  • Tag value: "2022-04-01"

Important Notes:

  • This task does not sync tags to metafields on an ongoing basis, nor does it delete existing metafields when there are no qualifying tags for a product.
  • If there are multiple qualifying tags on an object, then there is no guarantee on which one the task might utilize, but it will only be one of them in any case.
  • When using date and date_time metafield types, the tag value must be in ISO-8601 format (YYYY-MM-DD and YYYY-MM-DDTHH:MM::SS respectively).
  • For the boolean metafield type, the tag values can be any of the following: true, false, yes, no, 1, or 0. The resulting metafield value will be either "true" or "false".

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!