How to overwrite Magento 2 core files

Create New Module to override Magento 2 Core files. For module you have to create below files.

app/code/Namespace/Module/registration.php

app/code/Namespace/Module/etc/module.xml

Controller Override

app/code/Namespace/Module/registration.php

app/code/Namespace/Module/etc/module.xml

Controller Override

app/code/Namespace/Module/etc/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Checkout\Controller\Cart\Index" type="Namespace\Module\Controller\Cart\Index" /> 
</config>

sanu

admin

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top