Tag orders based on product metafields
Product metafields are used to store and display additional product information that doesn't otherwise exist on a product in the Shopify Admin.
For example, you may wish to add specific washing instructions to products so that they can be highlighted in a uniquely styled area on the product page.
Typically, you'd store this data in a product metafield with a unique Namespace and Key. The content of the product metafield can then be output for display onto the product page using liquid within your theme.
If you are looking to create a workflow based on product variant metafields, please take a look at our article on tagging orders based on the product variant metafield.
Managing metafields in Shopify
The management of Shopify metafields is not built into the Shopify Admin, but there are plenty of apps that you can use to manage your metafields. Some of the apps provide a browser plugin which does then inject this functionality into the Shopify Admin area alongside the associated resource (e.g. products, variants, collections, shop etc.). Take a look at some of the options for managing metafields in the Shopify app store:
How this criteria works
The product metafields criteria allow you to specify the Namespace and Key of a product metafield to look for. Each line item in the order will then be analyzed at the variant level to see if the product metafield that has been specified exists.
You can also optionally decide to check if the Value of that product metafield:
- exists or is not empty
- matches a particular string
- contains a particular string
You also have the option to automatically apply the Value of the product metafield as a tag to the order.
The product metafields criteria can be found in the Product category of the workflow criteria selector.
Configuring this criteria
Once you have located and selected the criteria, you will be presented with the following:
Enter the Namespace and Key of the product metafield that you are looking to target.
checking if the metafield exists
If you don't need to analyze the value of the field, but you do want to place a fixed tag on the order if the metafield exists, then you do not need to configure the criteria any further. Move on to applying the fixed tags.
Please note that if ANY of the products in the order contain the specified metafield, then the criteria will be considered a match.
Applying the value of the metafield as a tag
If you don't need to analyze the value of the field, but you do want to tag your orders with the value of the metafield, then select the Use matching metafield value as a tag option:
You then have the option to include a prefix or a suffix to the tag.
Please note that the value of ALL product metafields that match the Namespace and Key specified will be applied to the order as tags.
Checking the value of the metafield for the criteria to match
If you only want this workflow to match if the value of this metafield meets a certain condition, then you can do this by selecting the Also check the value option:
You then have these options with which to analyze the value of the product metafield:
The value is case sensitive, so please make sure that you type in the string you are searching for exactly as it is stored in the metafield value, otherwise, it will not match.
is: Does the value of the <strong>product metafield</strong> exactly match the string you have specified?
contains: Does the value of the product metafield contain the string you have specified anywhere in the value?
does not exist/is empty: Is the value of the product metafield empty or null?
Please also note:
For the remaining options the criteria will look for a number (integer or float). If the value of the metafield specified isn't a number then it will become zero.
So for example if the value of the metafield is "fudge" and the criteria has specified as less than 10, then it would match because "fudge" becomes 0."
Greater than: A number that you specify.
Greater than or equal to: A number that you specify.
Less than: A number that you specify.
Less than or equal to: A number that you specify.
Equal to: A number that you specify.
Select the most appropriate option for the type of match you are trying to make when checking the value of the metafield.
If you choose to then use the value as the tag, then only those products in the order that match the criteria conditions will have their values applied as tags to the order:
Adding a fixed tag
If you are adding fixed tags to the order, choose the name of the tag you'd like to see on all orders that match this workflow and enter it into the Add tags when the workflow matches FIXED TAGS TO BE APPLIED section:
Product metafields are not available as an attribute to use with our Dynamic Tagging feature.
The Product metafields criteria option will work when Backdating your orders, however, the metafield data is not held in the order data, but against the product. Therefore, only the value of the metafield as it currently stands will be used in the backdating job.