{"id":269,"date":"2018-12-21T12:48:02","date_gmt":"2018-12-21T12:48:02","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/2018\/12\/21\/set-anchor-to-yes-in-all-categories-in-magento-2\/"},"modified":"2025-05-22T17:10:34","modified_gmt":"2025-05-22T11:40:34","slug":"set-anchor-to-yes-in-all-categories-in-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/set-anchor-to-yes-in-all-categories-in-magento-2\/","title":{"rendered":"How to Set Anchor to YES in all Categories in Magento 2"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">In Magento 2 stores, by default, all the categories created through the admin is set to \u201cNo\u201d for the option \u201cis Anchor\u201d. Setting \u201c<strong>Is Anchor<\/strong>\u201d to \u201c<strong>Yes<\/strong>\u201d activates the Layered Navigation in Magento 2 which is also known as filtered navigation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To enable layered navigation, the admin has to follow certain steps for each category which areLogin to&nbsp;<strong>Admin panel<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1. Navigate to&nbsp;<strong>Catalog &gt; Categories<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2. Navigate to&nbsp;<strong>Catalog &gt; Categories<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3. Select the&nbsp;<strong>Category<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">4. Expand the&nbsp;<strong>Display Settings<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">5. Enable the&nbsp;<strong>Anchor<\/strong>&nbsp;to \u201cYES\u201d.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2018\/12\/Manually-set-anchor-to-yes-1024x435.png\" alt=\"Manually-set-anchor-to-yes\" class=\"wp-image-3955\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">There is no method to update this setting in bulk from Magento 2 admin and the task to set Anchor to YES in all Magento 2 categories one by one is tedious and time-consuming when you have a lot of categories.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What if I show the programmatic method to enable the layered navigation for all Magento 2 categories at once?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em><strong>Set anchor to YES in all categories in Magento 2&nbsp;<\/strong><\/em>with the SQL queries given here. It will save your time and offer layered navigation to the store visitors to help them easily find the products.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Method to Set Anchor to YES in all Categories in Magento 2:<br><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Identify the attribute id of the is_anchor attribute:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT * FROM eav_attribute where attribute_code = 'is_anchor'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now, run the below query to update all the category to Anchor YES:<br><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>UPDATE catalog_category_entity_int set value = 1 where attribute_id = 54;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And done!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With the above SQL commands, enrich the user experience on your store and at the same time reduce admin task by the programmatic method to&nbsp;<em><strong>set anchor to YES in all categories in Magento 2<\/strong><\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank You.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Magento 2 stores, by default, all the categories created through the admin is set to \u201cNo\u201d for the option \u201cis Anchor\u201d. Setting \u201cIs Anchor\u201d&#8230;<\/p>\n","protected":false},"author":5,"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-269","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/269","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\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=269"}],"version-history":[{"count":2,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/269\/revisions"}],"predecessor-version":[{"id":15542,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/269\/revisions\/15542"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=269"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=269"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=269"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}