{"id":392603,"date":"2023-08-07T14:53:39","date_gmt":"2023-08-07T14:53:39","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=392603"},"modified":"2023-08-07T14:55:55","modified_gmt":"2023-08-07T14:55:55","slug":"override-module-in-prestashop","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/override-module-in-prestashop\/","title":{"rendered":"Override module in PrestaShop"},"content":{"rendered":"\n<p>In this blog, we will learn how to override modules in PrestaShop. Sometimes, we need to enhance or modify the module feature then it is not recommended to modify the module file directly. If we modify the module files directly then in the future if you upgrade the module, all modifications will be lost. You can see the below PrestaShop official to know more about overriding:<\/p>\n\n\n\n<p><a href=\"https:\/\/devdocs.prestashop-project.org\/8\/modules\/concepts\/overrides\/\">https:\/\/devdocs.prestashop-project.org\/8\/modules\/concepts\/overrides\/<\/a><\/p>\n\n\n\n<p>We can override the below files of the module:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Main file<\/li>\n\n\n\n<li>Controller files (front &amp; admin)<\/li>\n<\/ul>\n\n\n\n<p><strong>Override module main file:<\/strong><\/p>\n\n\n\n<p>To override a module&#8217;s main class, you need to extend it and you have to provide the extended class the same name and add the <code>Override<\/code> suffix:<\/p>\n\n\n\n<p><strong>ie:<\/strong> If you want to override <code>ps_shoppingcart<\/code> module then the extended class name will be <code>Ps_ShoppingcartOverride<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">class Ps_ShoppingcartOverride extends Ps_Shoppingcart\n{\n    \/\/ Override the Ps_Shoppingcart methods here\n}<\/pre>\n\n\n\n<p><strong>Override module controller file:<\/strong><\/p>\n\n\n\n<p>You can override module admin and front controllers. To override module controllers, you have to do the same thing as done for overriding the module main class. You need to extend the controller class  and provide the extended class the same name and add the Override suffix:<\/p>\n\n\n\n<p>ie: If you want to override the <code>ps_emailsubscription<\/code> module front controller class <code>Ps_EmailsubscriptionSubscriptionModuleFrontController<\/code> then the extended class name should be <code>Ps_EmailsubscriptionSubscriptionModuleFrontControllerOverride<\/code>:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">class Ps_EmailsubscriptionSubscriptionModuleFrontControllerOverride extends Ps_EmailsubscriptionSubscriptionModuleFrontController \n{\n    public function postProcess()\n    {\n        ...\n    }\n}<\/pre>\n\n\n\n<p>In the same manner, you can also override the module admin controller. All overridden module files are moved to the PrestaShop override folder (override\/modules\/&lt;MODULE_NAME&gt;\/) during the installation of the module.<\/p>\n\n\n\n<p>That\u2019s all about this blog.<\/p>\n\n\n\n<p>If any issue or doubt please feel free to mention it in the comment section.<\/p>\n\n\n\n<p>I would be happy to help.<\/p>\n\n\n\n<p>Also, you can explore our\u00a0<a href=\"https:\/\/webkul.com\/prestashop-development\/\" target=\"_blank\" rel=\"noreferrer noopener\">PrestaShop Development Services<\/a>\u00a0&amp; a large range of quality\u00a0<a href=\"https:\/\/store.webkul.com\/PrestaShop-Extensions.html\" target=\"_blank\" rel=\"noreferrer noopener\">PrestaShop Modules<\/a>.<\/p>\n\n\n\n<p>For any doubt contact us at&nbsp;<a href=\"mailto:support@webkul.com\">support@webkul.com<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this blog, we will learn how to override modules in PrestaShop. Sometimes, we need to enhance or modify the module feature then it is not recommended to modify the module file directly. If we modify the module files directly then in the future if you upgrade the module, all modifications will be lost. You <a href=\"https:\/\/webkul.com\/blog\/override-module-in-prestashop\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":384,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[209],"tags":[2059,4193,2065],"class_list":["post-392603","post","type-post","status-publish","format-standard","hentry","category-prestashop","tag-module","tag-override","tag-prestashop"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Override module in PrestaShop - Webkul Blog<\/title>\n<meta name=\"description\" content=\"Sometimes we need to override the existing PrestaShop module functionality to implement or modify existing features. So, let&#039;s learn this.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/override-module-in-prestashop\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Override module in PrestaShop - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"Sometimes we need to override the existing PrestaShop module functionality to implement or modify existing features. So, let&#039;s learn this.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/override-module-in-prestashop\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-08-07T14:53:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-08-07T14:55:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Ajeet Chauhan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ajeet Chauhan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/override-module-in-prestashop\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/override-module-in-prestashop\/\"},\"author\":{\"name\":\"Ajeet Chauhan\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/7eee8f48857441660231d6a643103357\"},\"headline\":\"Override module in PrestaShop\",\"datePublished\":\"2023-08-07T14:53:39+00:00\",\"dateModified\":\"2023-08-07T14:55:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/override-module-in-prestashop\/\"},\"wordCount\":294,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"keywords\":[\"module\",\"Override\",\"prestashop\"],\"articleSection\":[\"prestashop\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/override-module-in-prestashop\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/override-module-in-prestashop\/\",\"url\":\"https:\/\/webkul.com\/blog\/override-module-in-prestashop\/\",\"name\":\"Override module in PrestaShop - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"datePublished\":\"2023-08-07T14:53:39+00:00\",\"dateModified\":\"2023-08-07T14:55:55+00:00\",\"description\":\"Sometimes we need to override the existing PrestaShop module functionality to implement or modify existing features. So, let's learn this.\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/override-module-in-prestashop\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/override-module-in-prestashop\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/override-module-in-prestashop\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Override module in PrestaShop\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/7eee8f48857441660231d6a643103357\",\"name\":\"Ajeet Chauhan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e97b5fe8122a2283f5fe35ae6fca4725ac46026413ce7959b575f842f6bd6c92?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e97b5fe8122a2283f5fe35ae6fca4725ac46026413ce7959b575f842f6bd6c92?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Ajeet Chauhan\"},\"description\":\"Ajeet is a talented Software Engineer specializing in the PrestaShop platform. With expertise in PrestaShop Shipping &amp; Payments Integration, Marketplace Development, and Headless services, he delivers innovative solutions that enhance eCommerce functionality, driving seamless operations for businesses and their customers.\",\"url\":\"https:\/\/webkul.com\/blog\/author\/ajeetchauhan-symfony143\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Override module in PrestaShop - Webkul Blog","description":"Sometimes we need to override the existing PrestaShop module functionality to implement or modify existing features. So, let's learn this.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/override-module-in-prestashop\/","og_locale":"en_US","og_type":"article","og_title":"Override module in PrestaShop - Webkul Blog","og_description":"Sometimes we need to override the existing PrestaShop module functionality to implement or modify existing features. So, let's learn this.","og_url":"https:\/\/webkul.com\/blog\/override-module-in-prestashop\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2023-08-07T14:53:39+00:00","article_modified_time":"2023-08-07T14:55:55+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png","type":"image\/png"}],"author":"Ajeet Chauhan","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Ajeet Chauhan","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/override-module-in-prestashop\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/override-module-in-prestashop\/"},"author":{"name":"Ajeet Chauhan","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/7eee8f48857441660231d6a643103357"},"headline":"Override module in PrestaShop","datePublished":"2023-08-07T14:53:39+00:00","dateModified":"2023-08-07T14:55:55+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/override-module-in-prestashop\/"},"wordCount":294,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"keywords":["module","Override","prestashop"],"articleSection":["prestashop"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/override-module-in-prestashop\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/override-module-in-prestashop\/","url":"https:\/\/webkul.com\/blog\/override-module-in-prestashop\/","name":"Override module in PrestaShop - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"datePublished":"2023-08-07T14:53:39+00:00","dateModified":"2023-08-07T14:55:55+00:00","description":"Sometimes we need to override the existing PrestaShop module functionality to implement or modify existing features. So, let's learn this.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/override-module-in-prestashop\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/override-module-in-prestashop\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/override-module-in-prestashop\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Override module in PrestaShop"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/7eee8f48857441660231d6a643103357","name":"Ajeet Chauhan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e97b5fe8122a2283f5fe35ae6fca4725ac46026413ce7959b575f842f6bd6c92?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e97b5fe8122a2283f5fe35ae6fca4725ac46026413ce7959b575f842f6bd6c92?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Ajeet Chauhan"},"description":"Ajeet is a talented Software Engineer specializing in the PrestaShop platform. With expertise in PrestaShop Shipping &amp; Payments Integration, Marketplace Development, and Headless services, he delivers innovative solutions that enhance eCommerce functionality, driving seamless operations for businesses and their customers.","url":"https:\/\/webkul.com\/blog\/author\/ajeetchauhan-symfony143\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/392603","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/384"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=392603"}],"version-history":[{"count":12,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/392603\/revisions"}],"predecessor-version":[{"id":394458,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/392603\/revisions\/394458"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=392603"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=392603"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=392603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}