for

Named tags

The special case of named tags


The named tags option allows you to index tags in a specific object inside the named_tags attribute. The tags it'll take into account are tags using this form: key:value. If multiple tags are found for the same key, an array will be created.

Their best advantage is that the don't require an API call to Shopify's servers to be retrieved, which makes them way faster than Metafields.

Example

{
  tags: [
    'expensive',
    'type:furniture',
    'fabric:cotton',
    'fabric:wood'
  ],
  named_tags: {
    type: 'furniture',
    fabric: [
      'cotton',
      'wood'
    ]
  }
}

To activate them, just check the indexing option in the Indexing tab.

Named tags screenshot
Shopify limits tags to be maximum 255 characters. If you want to index longer strings, you'll have to use Metafields.
Tags, inside Shopify, are stored as a long string, and are then splitted on commas. If you want to have commas in your text values, the encoded type described afterwards should help you.

Types

We currently support four different types of named tags:

Default

attr:value
Extracts value as a string
Can't contain a comma

Example: author:Isaac Asimov

Boolean

attr:boolean:value
Extracts value - true or false - as a boolean

Example: suitable_for_children:boolean:true

Number

attr:number:value
Extracts value - integer or decimal - as a number

Example: age:number:34
Example: alternative_price:number:199.90

Encoded

attr:encoded:value
Extracts and decodes an URL-encoded value
Allows for commas

Example: alternative_name:encoded:Me%2C%20Myself%20and%20I - Me, Myself and I

To our knowledge, you only need to replace , by %2C, but this is a safe way to make sure any character won't be badly interpreted by Shopify's tag engine

To encode to your string to this format, you can use:

Restrict to some variants

You might want to restrict some of those named tags only to a subset of your variants, and unfortunately, tags are only available at the product level. To handle this, we've added a simple syntax to our named tags: [option_name:option_value].

Examples:

  • [size:S]long_name:Small
  • [size:S][color:blue]original_price:number:19.90

If you have a product with multiple options, e.g. size, and color, and only specify one of them, the named tag will be applied to all of the matching ones.

Finally, to handle long option values, you can use a * at the end of the value to target all of the option values starting with this string.
For instance, [color:B*] will apply to both Blue and Brown colors.