Magento 2 – Fix Override HTML Template File Not Working

billing-addressfrontendmagento2requirejstemplate

I want to override Magento 2 html template located at

vendor/magento/module-checkout/view/frontend/web/template/billing-address/details.html

I tried using require-config.js for frontend like this:

var config = { 
    map: {
       '*': {
         'Magento_Checkout/template/billing-address/details':
             'Namespace_Module/template/billing-address/details'
    }
  }
};

and I put that file at

Namespace/Module/view/frontend/template/billing-address/details.html

But I got the following error:

Unable to resolve the source file for 'frontend/Vendor/vendor_theme/en_US/Namespace_Module/template/billing-address/details.html' #0 /var/www/rotoki/vendor/magento/framework/App/StaticResource.php(97)

I think Magento is trying to find that file inside my theme folder instead of my module folder.

Best Answer

Just copy file from

vendor/magento/module-checkout/view/frontend/web/template/billing-address/details.html

And put it to

app/design/frontend/Vendor/YourTheme/Magento_Checkout/web/template/billing-address/details.html

Run below commads for deploy static content

php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
php bin/magento cache:clean