Filtering products by Metafield value

đź“– As a Shopify merchant, you know how powerful Metafields are. Shopify Metafields allows you to save specialized information that is 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 are selling second-hand jackets and you want to display their condition in percentage values on the storefront. Metafields can help you with that.

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

In the example of selling second-hand jackets, you might 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

On this page


Add product Metafields to the app’s admin

To create a filter for your Metafield values on your storefront, the Metafield, which contains all those values, needs to first be added to the app's admin successfully. 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, you can send your request to support@boostcommerce.net 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 that 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

  1. In the Applies to section:
    • The Display option is checked by default, meaning that 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 if you want 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 new single_line_text_field metafields specifically for filtering purposes.

  1. Click Save and wait about 3 minutes to let the sync process complete.
  2. [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 are certain that you have filled in the correct namespace and key, you can try to 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.
  1. Fill in how you want the filter to appear on your storefront under the Option label heading.
  2. Customize other settings to your liking.
  3. Click Save on the Edit filter option page.
  4. Click Save on the Filter options page.

Check how the new filter option applies to your storefront.


If you have any other questions, please feel free to reach out to our support team via support@boostcommerce.net.