Pergunta

How can we override a knockout template in a custom module? I know how we can do this in our own theme but I need this in a module.

For example I like to override this file: vendor/magento/module-checkout/view/frontend/web/template/shipping-address/form.html

Is this possible?

Foi útil?

Solução

Yes you can override a knockout template in a custom module, just did it, in your module create a requirejs-config.js file and place it in your module:

app/code/Namespace/Module/view/frontend/requirejs-config.js

In the file add the configuration to specify the override:

var config = {
    map: {
        '*': {
            'Magento_Checkout/template/billing-address':
                'Namespace_Module/template/billing-address'
        }
    }
};
Licenciado em: CC-BY-SA com atribuição
Não afiliado a magento.stackexchange
scroll top