🎉 Try the public beta of the new docs site at algolia.com/doc-beta! 🎉
Integrations / Shopify

From December 31, 2023, Algolia’s Search and Discovery application can’t modify the coding of Shopify themes. For more information, refer to Shopify’s Asset API documentation. As an alternative, Algolia offers Shopify’s App Embed and App Blocks features for Autocomplete and InstantSearch interfaces. For more information, refer to the Quick start and Shopify Algolia configuration documentation.

Named tags are an optimized alternative to Shopify’s metafields. Named tags automatically generate key-value attribute pairs from specifically formatted tags.

Shopify limits tags to 255 characters per tag. If you want to index longer strings, use metafields.

Shopify lets you apply up to 250 tags to each product. If you’re adding many tags to your products, you should also keep your Algolia record size limit in mind.

Enabling named tags

To activate named tags, go to the Products section of the Indexing tab and check the box that says Index named tags.

Enable named tags in your Shopify admin

Shopify stores tags as long comma-split strings. To use commas in your text values, use the encoded type described below.

Adding named tags

To add a named tag to a product, you must go to that product’s page on Shopify and add a tag with the proper named tag format. Currently, four different types of named tags are accepted:

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 a URL-encoded value. Allows for commas.

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

You need to replace , by %2C, but the URL-encoded approach provides a safe way to make sure that all characters are properly interpreted by Shopify’s tag engine.

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

Restricting named tags to specific variants

Shopify tags are only available at the product level, so you can’t restrict them to a subset of your variants. Algolia provides a workaround with named tags.

To do this, include a bracketed specifier in front of the named tag: [option_name:option_value]variant_tag:variant_tag_option.

For example:

  1. if you want to add the named tag long_name:Small to a product’s size S variant, then add the following tag to the product: [size:S]long_name:Small.
  2. if you want to add the named tag original_price:number:19.90 to a product’s size S and blue variant, then add the following tag to the product: [size:S][color:blue]original_price:number:19.90

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

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.

Did you find this page helpful?