Deeban Babu
Deeban Babu

Reputation: 729

How to override html file in magento 2.1

I need to customize Magento_Checkout module.

I have tried to copied that html files into my theme path but the override is not working

Override path mentioned in below

/app/design/frontend/Vendor/ThemeName/Magento_Checkout/web/template

But the file is taken from

/vendor/magento/module-checkout/view/frontend/web/template

How to override this template html files?

Upvotes: 3

Views: 7320

Answers (2)

Sony
Sony

Reputation: 219

What you can do if something like this :

var config = {
    map: {
        '*': {
            'Magento_Checkout/template/shipping.html': 'MyNameSpace_MyModule/template/shipping.html'

        },
    }
};

Basically you have to create your own Vendor module, and declare it in a requirejs-config.js into MyNameSpace/MyModule/view/frontend/requirejs-config.js

Hope it helps!

Upvotes: 6

Danil
Danil

Reputation: 284

Suppose you want to overwrite the file:

vendor/magento/module-checkout/view/frontend/web/template/shipping.html

For this, you need to place the replacement file in:

app/design/frontend/{Vendor}/{Theme}/Magento_Checkout/web/template/shipping.html

If you do not see the changes after a page refresh, try to flush JavaScript/CSS Cache and Static Files cache.

Upvotes: 6

Related Questions