Skip to content

Magento 2 : Override HTML Template from Module

let’s say you want override this html template from your custom module (not from your custom theme)

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

first, create a module, for example module MyModule_TestOverride (i assume you already know, how to create basic magento 2 module)

  1. copy custom file file  shipping.phtml to MyModule\TestOverride\view\frontend\web\template
  2. create file requirejs-config.js, put in MyModule\TestOverride\view\frontend
var config = {
    map: {
        '*': {
          'Magento_Checkout/template/shipping.html': 
              'MyModule_TestOverride/template/shipping.html'
        }
  }
};

3.  last step, from your shell, execute this command : “php bin/magento setup:static-content:deploy”

Share

Comments are closed.