{"id":1750,"date":"2021-05-04T12:23:40","date_gmt":"2021-05-04T12:23:40","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/override-category-view-page-in-magento-2\/"},"modified":"2025-07-16T17:54:49","modified_gmt":"2025-07-16T12:24:49","slug":"override-category-view-page-in-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/override-category-view-page-in-magento-2\/","title":{"rendered":"How to Override Category View Page in Magento 2"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Overriding a category view page can be considered as one of the most common tasks for a developer who works on adding functionalities in the category view page in the Magento 2 platform.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As it is well known that customizing the core\u00a0Magento 2\u00a0functionality is a bad coding practice. Thus, it is advisable to override the file instead of modifying any default Magento file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For instance, you have created a module that adds a button on the category page which prints all the product data in CSV format. In that case, you need to&nbsp;<em><strong>override category view page in Magento 2<\/strong><\/em>&nbsp;to add a well-functioned button on the category view page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use the below method and add any custom functionality on the category view page as per your requirement.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Method to Override Category View Page in Magento 2<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">1. &nbsp;Use the below code in the&nbsp;<strong>catalog_category_view.xml&nbsp;<\/strong>file at&nbsp;<strong><strong>app\/code\/Vendor\/Module\/view\/frontend\/layout<\/strong><\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?xml version=\"1.0\"?>\n&lt;page xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" layout=\"2columns-left\"\n      xsi:noNamespaceSchemaLocation=\"urn:magento:framework:View\/Layout\/etc\/page_configuration.xsd\">\n    &lt;body>\n        &lt;referenceBlock name=\"category.products.list\">\n            &lt;action method=\"setTemplate\">\n                &lt;argument name=\"template\" xsi:type=\"string\">Vendor_Module::product\/list.phtml&lt;\/argument>\n            &lt;\/action>\n        &lt;\/referenceBlock>\n    &lt;\/body>\n&lt;\/page><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2. Now you need to create&nbsp;<strong>list.phtml<\/strong>&nbsp;at location&nbsp;<strong>app\/code\/Vendor\/Module\/view\/frontend\/templates\/product<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s all! Likewise you can also&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/override-product-view-page-social-meta-tags-in-magento-2\/\">override product view page social meta tags Magento 2<\/a>, as a store owner it will help you to hide social meta tag or dynamically change content of social meta tags.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Feel free to share the post with fellow developers via social media.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can also refer to the relevant solution to&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/override-block-model-controller-magento-2\/\" target=\"_blank\" rel=\"noreferrer noopener\">override block, model, and controller in Magento 2<\/a>&nbsp;and&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/override-phtml-file-using-custom-module-in-magento-2\/\" target=\"_blank\" rel=\"noreferrer noopener\">override a phtml file using a custom module in Magento 2<\/a>&nbsp;that I posted earlier.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Overriding a category view page can be considered as one of the most common tasks for a developer who works on adding functionalities in the&#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-1750","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1750","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=1750"}],"version-history":[{"count":4,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1750\/revisions"}],"predecessor-version":[{"id":18090,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1750\/revisions\/18090"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=1750"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=1750"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=1750"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}