I'm building an extention on the M2 checkout. A requirement for this is that a specific third party module is used for zip code checks. This module works fine except for one bug.
Now to fix this bug I need to change one line in the postcode.js file of that module. I would prefer to change that line in my own module to make it easier implementable in different projects.
(The problem is that the other module tries to show the region when the region field is unset so it shows undefined so I need to uncomment that line.)
Now I know that the file could be overwritten in the theme. I got that answer on the stackexchange, but I would prefer it if there is a solution where i can overwrite it in my module. Is this possible?
The file i'm trying to overwrite is in Wezz/Postcodem2 > web > js > view > postcode.js
Solved! Go to Solution.
Hello,
you need to create view/frontend/requirejs-config.js
var config = { config: { mixins: { 'Magento_Swatches/js/swatch-renderer': { 'ModuleNmae_ConfigurableProductExtended/js/swatch-renderer-mixins': true }, } } };
Same way you can do it
Hello,
you need to create view/frontend/requirejs-config.js
var config = { config: { mixins: { 'Magento_Swatches/js/swatch-renderer': { 'ModuleNmae_ConfigurableProductExtended/js/swatch-renderer-mixins': true }, } } };
Same way you can do it
Isn't that only useable for overwriting default Magento2 modules? Or also for files in other modules?
Hello @SannNL
yes, you can override another module as well.
Make sure sequence of your module after that module.
Hope it will help you if it will work then mark as solution
Putting it in the mixin part of requirejs didn't work but putting it in 'map' did. Thanks.
var config = { config: { mixins: { 'Magento_Checkout/js/view/shipping': { 'BB_Checkout/js/mixin/shipping-mixin': true } } }, 'map': { '*': { 'Wezz_Postcode/js/view/postcode': 'BB_Checkout/js/view/postcode-overwrite' } } };
Hello
can you paste the code from requirejs-config.js from pub/static/frontend/PackageName/Themename/en_US?