Tag orders based on product variant 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 also use product variants in your product structure, you can go one step deeper with metafields and store data in the product variant metafield. Storing additional data at the variant level would allow you to describe the difference between the variants of a particular product, e.g. material, features, etc.

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:

https://apps.shopify.com/search?q=metafields

How this criteria works

The product variant metafields criteria allow you to specify the Namespace and Key of a product variant metafield to look for.  Each line item in the order will then be analyzed at the variant level to see if the product variant metafield that has been specified exists.

You can also optionally decide to check if the Value of that product variant 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 variant metafield as a tag to the order.

Criteria category

The product variant metafields criteria can be found in the Product category of the workflow criteria selector.

How to find and select a criteria

If you are creating your first workflow in Order Tagger, you might find the following video useful to see how to locate and select a criteria for your workflow:

Configuring this criteria

To create a workflow using this criteria, click on the Create New Workflow button from the main Workflows view:

Define the trigger to determine at which point you would like the workflow to run, we recommend selecting the trigger when orders are created.

Click the Add criteria to my workflow button:

The Product Variants Metafields in the order criteria can be found within the Product category in the Select criteria pop-up window:

Once you have located and selected the criteria, you will be presented with the following:

Enter the Namespace and Key of the product variant 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 product variants 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 variant 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 analyse the value of the product variant metafield:

Please note:

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 product variant metafield exactly match the string you have specified?

contains: Does the value of the product variant metafield contain the string you have specified anywhere in the value?

does not exist/is empty: Is the value of the product variant 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 variants 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:

Dynamic Tagging

Product variant metafields are not available as an attribute to use with our Dynamic Tagging feature.

Backdating

The Product variant 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.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us