{"id":1315,"date":"2020-10-24T18:00:58","date_gmt":"2020-10-24T18:00:58","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/2020\/10\/24\/override-extension-file-in-theme-in-magento-2\/"},"modified":"2025-05-22T11:35:34","modified_gmt":"2025-05-22T06:05:34","slug":"override-extension-file-in-theme-in-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/override-extension-file-in-theme-in-magento-2\/","title":{"rendered":"How to Override Extension File in Theme in Magento 2"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Store owners&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/install-a-theme-in-magento-2\/\" target=\"_blank\" rel=\"noreferrer noopener\">install a theme in Magento 2<\/a>&nbsp;and use it in their online store for a consistent look and feel in the store frontend or the admin area, with the help of custom templates, layouts, styles or images.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When you are using a custom theme, the design of any third party extensions\u2019 frontend may not match with the layout of your store.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, a banner is displayed in the frontend when you enable a third party extension. This banner is not designed keeping in mind any custom theme designs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The solution to this issue is to&nbsp;<em><strong>override extension file in theme in Magento 2<\/strong><\/em>. The store owner can programmatically override the extension file and implement any changes required based on the business requirements without making any permanent changes in the original file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Moreover, when a new version of an extension is released, you do not need to customize the required changes each time.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Hence, it is better to override the extension file when using&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/best-magento-2-themes\/\" target=\"_blank\" rel=\"noreferrer noopener\">custom themes<\/a>&nbsp;in Magento 2 rather than making changes in the original file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Method to Override Extension File in Theme in Magento 2:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Suppose, you want to override extension file in a theme.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The theme file path is:<\/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=\"\">app\\code\\Vendor\\Extension\\view\\frontend\\templates\\list.phtml<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The path when you override that file in theme will be:<\/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=\"\">app\\design\\frontend\\&lt;theme_package>Vendor_Extension\\templates\\list.phtml<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also, do 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>Store owners&nbsp;install a theme in Magento 2&nbsp;and use it in their online store for a consistent look and feel in the store frontend or the&#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-1315","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1315","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=1315"}],"version-history":[{"count":3,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1315\/revisions"}],"predecessor-version":[{"id":14638,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1315\/revisions\/14638"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=1315"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=1315"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=1315"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}