{"id":1595,"date":"2021-02-22T09:48:02","date_gmt":"2021-02-22T09:48:02","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/remove-filterable-attribute-values-with-0-products-from-magento-2-layered-navigation\/"},"modified":"2025-07-24T14:52:20","modified_gmt":"2025-07-24T09:22:20","slug":"remove-filterable-attribute-values-with-0-products-from-magento-2-layered-navigation","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/remove-filterable-attribute-values-with-0-products-from-magento-2-layered-navigation\/","title":{"rendered":"How to Remove Filterable Attribute Values with 0 Products from Magento 2 Layered Navigation"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Your online store visitor does not have time to browse all the products and find what they are looking for. This process should be as seamless as walking in a brick and mortar store and asking for an item.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/meetanshi.com\/blog\/configure-layered-navigation-in-magento-2\/\" target=\"_blank\" rel=\"noreferrer noopener\">Layered Navigation in&nbsp;Magento 2<\/a>&nbsp;allows users to narrow their search with filters for category, price, brand, or any other available attributes to find the desired product. It improves the on-site experience and speeds up the conversion process.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In default&nbsp;Magento 2, the layered navigation appears in the left column of the category page, search result pages and sometimes on the&nbsp;store\u2019s home page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Layered navigation includes filters for all available attribute values and their product counts, including those with zero (0) product matches as shown in below image:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2021\/02\/before-1024x533.jpg\" alt=\"How to Remove Filterable Attribute Values with 0 Products from Magento 2 Layered Navigation\" class=\"wp-image-13263\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">That looks bulky and becomes complicated for customers to choose a preferable product if large amounts of categories and products are there. Also, it is unnecessary to display attribute values with 0 products on the frontend.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Hence, I have come up with the below solution to&nbsp;<em><strong>remove filterable attribute values with 0 products from Magento 2 layered navigation&nbsp;<\/strong><\/em>and omit the attribute values with a count of zero (0) product matches.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Method to remove filterable attribute values with 0 products from Magento 2 layered navigation<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">1. <strong>Login<\/strong>&nbsp;to the admin panel.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2. Navigate to&nbsp;<strong>Stores &gt; Attributes &gt; Product.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3. Select and open the attribute.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3. Click on&nbsp;<strong>Storefront Properties&nbsp;<\/strong>under&nbsp;<strong>Attribute Information<\/strong>&nbsp;section.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2021\/02\/ss-1024x433.jpg\" alt=\"How to Remove Filterable Attribute Values with 0 Products from Magento 2 Layered Navigation\" class=\"wp-image-13253\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">5. Select&nbsp;<strong>Filterable (with results)&nbsp;<\/strong>from the&nbsp;<strong>Use in Layered Navigation&nbsp;<\/strong>dropdown.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">6. Click on&nbsp;<strong>Save Attribute<\/strong>&nbsp;button.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After applying the above method, layered navigation includes only those filters for which matching products can be found as mentioned in the below image:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2021\/02\/after-1024x549.jpg\" alt=\"How to Remove Filterable Attribute Values with 0 Products from Magento 2 Layered Navigation\" class=\"wp-image-13260\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Any attribute value that already applies to all products shown in the list should still appear as an available filter. Attribute values with a count of zero (0) product matches are omitted from the list of available filters.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Quite easy, right?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you still want to improve the navigation further, you can&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/sort-magento-2-layered-navigation-attributes-programmatically\/\" target=\"_blank\" rel=\"noreferrer noopener\">sort Magento 2 layered navigation attributes programmatically<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Do not forget to share the solution with Magento Community via social media.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank You.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Your online store visitor does not have time to browse all the products and find what they are looking for. This process should be as&#8230;<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-1595","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1595","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=1595"}],"version-history":[{"count":2,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1595\/revisions"}],"predecessor-version":[{"id":14482,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1595\/revisions\/14482"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=1595"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=1595"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=1595"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}