Shopify metafields
Search.io supports Shopify metafields. Adding metafields to Search.io can further improve your store’s search ranking and relevance, and display product metafield data in your search results.
Last updated
Search.io supports Shopify metafields. Adding metafields to Search.io can further improve your store’s search ranking and relevance, and display product metafield data in your search results.
Last updated
Your store must have the Search.io Shopify App installed. To install the app, follow these instructions.
Log in to the Search.io Console.
Navigate to the Schema section.
Click Add metafield.
Select a metafield definition from the dropdown list. Only product and variant metafield definitions are supported. Refer to Shopify’s documentation if you need to add a metafield definition to your store.
Select Indexed if want the metafield to be searchable. Refer to the supported metafield content types for a list of content types that can be indexed.
Click Add metafield. Search.io creates the necessary schema fields for the selected metafield definition. Metafields containing values which need to be represented in different ways will generate multiple fields.
Repeat steps 3-6 to sync additional metafields, or click Sync products to trigger a full products sync with Search.io. Triggering a sync updates the records in your collection with the new metafield values.
A full products sync can take several minutes to a few hours, depending on the number of products in your store.
The following table shows the schema field mappings for each metafield type. Note that some metafields may be mapped to multiple schema fields.
Product metafields are mapped to schema fields with prefix metafield_{namespace}_{key}
.
Variant metafields are mapped to array schema fields with prefix variant_metafield_{namespace}_{key}
.
Metafield content types | Description | Search.io schema types | Can be indexed |
Single line text | A single-line text field. | String | Yes |
Multi-line text | A multi-line text field. | String | Yes |
Page reference | A reference to a page on the online store.
e.g. | String | Yes |
Variant reference | A reference to a product variant on the online store.
e.g. | String | Yes |
Integer | A whole number in the range of +/-9,007,199,254,740,991. | Integer | No |
Date | A date in ISO 8601 format without a presumed timezone. | Timestamp | No |
Date and time | A date and time in ISO 8601 format without a presumed timezone. | Timestamp | No |
JSON string | A JSON-formatted string.
Note: The | String | Yes |
Boolean | A true or false value. | Boolean | No |
Color | The hexadecimal code for a color. | String | Yes |
Weight | A value and a unit of weight. Valid unit values: |
| No |
Volume | A value and a unit of volume. Valid unit values: |
| No |
Dimension | A value and a unit of length. Valid unit values: |
| No |
Rating | A rating measured on a specified decimal scale. |
| No |
Search.io works right out of the box for Shopify stores. Metafields can be used to further improve your store’s search relevance and ranking by customizing your search algorithm.
If a metafield has been configured to be indexed, you should add it to the textual relevance in your search settings so the metafield’s values can be used for textual relevance in search results.
Metafields can also be used to make ranking adjustments, to further fine-tune your search results.
In the Search.io Console, click Shopify in the Integration section.
In the Filters section, click Add.
Select the metafield from the Field dropdown, and specify a Title.
The filter will appear in your search preview.
Once you are happy with the search UI, click the Install button. Follow the installation instructions which are tailored to your configuration.
If you are manually installing Search.io into a live store, we recommend that you duplicate the active theme and first install the search UI to that theme. This lets you check everything is perfect before you push it live.
This section covers an advanced topic, and requires:
Basic knowledge of HTML and CSS,
Familiarity with the Tempura template language.
In the Search.io Console, click Shopify in the Integration section.
Select the Custom option in the Search result template section.
Click Edit.
Select a template (e.g. Default) and click Next.
Add the schema field for the corresponding metafield to the HTML template. e.g. For a product field metafield with namespace and key my_fields.description
, the corresponding schema field name is metafield_my_fields_description
.
Reference the schema field like this:
{{ #expect metafield_my_fields_description }}
{{#if metafield_my_fields_description}} metafield_my_fields_description {{/if}}
Click Save.
Once you are happy with the search UI, click the Install button. Follow the installation instructions which are tailored to your configuration.
If you are manually installing Search.io into a live store, we recommend that you duplicate the active theme and first install the search UI to that theme. This lets you check everything is perfect before you push it live.
Click Add filter.
The #expect
annotation is required to prevent the template from erroring if the product does not contain a metafield. The display of the metafield is inside an #if
statement to ensure that nothing is rendered if the product does not contain a metafield.