Skip to main content
All CollectionsFilterManage Filter Trees
Filtering products by Metafield value
Filtering products by Metafield value

In this article, we will show you how to set up your filters with the metafield values

Connell Nguyen avatar
Written by Connell Nguyen
Updated over a week ago

šŸ“– As a Shopify merchant, you know how powerful Metafields are. Shopify Metafields allows you to save specialized information not provided by Shopify admin by default, add custom fields to any page or object in your store, and track your customers more efficiently. For instance, you sell second-hand jackets and want to display their condition in percentage values on the storefront. Metafields can help you with that.

From August 2021, Shopify has allowed you to create and manage Metafields in the Shopify admin. You can still use other Metafield apps from the Shopify App Store as they have more advanced features.

In the example of selling second-hand jackets, you want to set up a filter that contains percentage values on the collection page like the following image, and you can do that with our app. As the app allows you to offer thematic filters by creating a ā€œtagā€ or a ā€œmulti-level tagā€ filter option, it also lets you create a filter for your Metafieldsā€™ values.

Filtering products by using Metafield value

Add product Metafields to the appā€™s admin

To create a filter for your Metafield values on your storefront, the Metafield, containing all those values, must be successfully added to the app's admin. The app can sync values of product Metafields which are created either directly from Shopify or by using an app from the Shopify App Store.

šŸ’” The app lets you add up to 5 Metafields to apply to your site search and filtering solutions. To add more than 5 Metafields to the app, please request [email protected] for further assistance.

Steps:

1. From our appā€™s admin, go to Tool > Metafields.

2. Click Add metafield and fill in the namespace and the key of the specific Metafield you want the app to sync its values.

  • In the example of selling second-hand jackets, you have created a product Metafield from Shopify admin as product_field.product_condition, then you fill in the namespace as product_field and the key as product_condition.

3. In the Applies to section:

  • The Display option is checked by default, meaning the Metafield data will be added to all products.

  • Select Search if you want the added Metafield to be searchable in Instant Search results.

  • Select Filter option if you want to create a filter option by Metafield.

  • Select Sort by option to sort out potential products based on appropriate Metafield data.

āš ļø Our Filter option feature is optimized to work seamlessly with single_line_text_field metafields type. If you have existing metafields of a different type, consider creating a new single_line_text_field metafields specifically for filtering purposes.

4. Click Save and wait about 3 minutes to let the sync process complete.

5. [Optional] When you encounter an error message that says ā€œInvalid metafields foundā€ or ā€œIncorrect information or metafield not found in productsā€:

  • You might have filled in the wrong Metafield's namespace and key.

  • The products with the corresponding Metafields might have been deleted.

  • When you have filled in the correct namespace and key, you can connect that Metafield to your theme to display specialized information on your storefront. Then you refresh the Metafields page from our appā€™s admin to check if the error message disappears.


Create a filter for Metafield values

Now you can create a filter for values of the Metafield you have added successfully to Boost AI Search & Discovery database.

Steps:

  1. From the appā€™s admin, go to Filter > Manage filter trees.

  2. Click the filter tree that you want to set up a filter for the Metafield values.

  3. Click Add filter option.

  4. In the drop-down of Option Type, select the phrase that starts with "Metafield-" and shows the namespace and the key of the Metafield you want to use its values.

In the example of selling global-shipping clothes, the phrase that you must select in the drop-down of Option Type looks like the following:

šŸ’” When you cannot find the Metafield you have added to the app's admin in the drop-down of Option Type:

  • You might have not added the Metafield successfully to the app's admin due to Invalid metafields found or Incorrect information or metafield not found in products errors.

  • You might have not selected the Filter option in the Applies to section when adding the Metafield to the app's admin.

5. Fill in how you want the filter to appear on your storefront under the Option label heading.

6. Customize other settings to your liking.

7. Click Save on the Edit filter option page.

8. Click Save on the Filter options page.

Please check how the new filter option applies to your storefront.


ā€‹If you have any questions or need further assistance, please do not hesitate to contact our dedicated support team at [email protected].

Did this answer your question?