How to create Custom Filter via Shopify Metafields

Creating Custom Filter via Shopify Metafields

Sam as to the product variant, you can create custom filters by creating meta fields either for product or variant. While adding a meta field for custom filter use, you need to make sure the content type should be one of the following:

  • Single-Line Text
  • Integer or Decimal Number

Follow these steps to create a meta field definition:

  1. Go to Settings > Metafields from your Shopify store admin.
  2. Select the type of metafield you want to create. Let’s say, Products.
  3. Click the Add definition button.
  4. In the Name field, enter a name for your definition, such as “Age Group”.
  5. Next, enter a description for your metafield values (optional).
  6. Click Select content type, and then select the content type (Text or Number).
  7. If the Content type is Text, select “Single line text”. And for Number content type, select either Integer or Decimal.
  8. In the Validation section, configure the Additional rules to limit the range of accepted values (optional).
  9. Save the changes.

After creating a meta field definition, you need to add values to this meta field. Follow the steps to add values to the product meta field definition:

  1. Go to Products > All products from your Shopify store admin.
  2. Click on any product.
  3. Scroll down to the metafields section, enter the value for the recently created metafield, i.e. Age Group.
  4. Save the changes.

 You’ve successfully created a custom filter by creating a meta field. Now, you can check whether your recently created meta field is present in the filter options or not. Also, you can add it to show on your collection page by following the below steps:

  1. Go to Online Store > Navigation from Shopify store admin.
  2. Click on Add filters.
  3. In Metafields options, select the recently created metafield, i.e. “Age Group”.
  4. Click Done.

Show your filter in fronted

Let me know if this solves your problem or if you need further help!

Thanks

How to create Custom Filter via Shopify Metafieldsexpoundsofttechsolution How to create Custom Filter via Shopify Metafields