0

Old user, Noob question!

I have a module which is successfully "trying" to overide the sidebar.html block using the below code.

var config = { "map": { "*": { "Magento_Checkout/template/sidebar.html": "MyBrand/MyModule/template/sidebar.html" } } }; 

The problem is, I'm not sure where in my module directory to place the actual replacement file ie.

in app/code/MyBrand/MyModule or app/design/MyBrand/MyModule or somewhere else.

I have tried several places for this file "sidebar.html" and several directory references but no joy. The GET command fails to locate the replacement file. I can't quite understand how Magento sees or starts from when using this directory.

Update command, deploy and cache clear run after every attempt.

Any help greatly appreciated.

Cheers

1 Answer 1

1

To override an HTML file through RequireJS with the map configuration, you should have the following configuration:

var config = { map: { '*': { 'Magento_Checkout/template/sidebar.html': 'VendorName_ModuleName/template/sidebar.html' } } }; 

You can place your requirejs-config.js in either your module directory or the <VendorName>_<ModuleName> directory within your theme.

  • Add your requirejs-config.js in your module directory (app/code/<VendorName>/<ModuleName>/view/frontend/) to apply the customization to all themes.
  • Add your requirejs-config.js in the <VendorName>_<ModuleName> directory in your theme (app/design/themeVendor/themeName/<VendorName>_<ModuleName>) to apply the customization to a specific theme.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.