Question

For testing purpose, we have modified the core file post-code.js which is in the path /vendor/Magento/module-ui/view/base/web/js/form/element and see it's working fine. So we have decided to override the file post-code.js.

For overriding, we have followed the below steps:

  1. Created and copied the files on

app/design/frontend/[VendorName]/[theme]/module-ui/web/js/form/element

  1. Run the below commands

    php bin/magento setup:upgrade
    php bin/magento setup:di:compile
    php bin/magento setup:static-content:deploy -f
    

But it's not working as expected.

Could anyone please tell me how to override the "post-code.js"?

Was it helpful?

Solution

Try this,

You must rename your module-ui to Magento_Ui

Copy the file from below path

vendor/magento/module-ui/view/base/web/js/form/element/post-code.js

to

app/design/frontend/{Vendor}/{theme-name}/Magento_Ui/web/js/form/element/post-code.js

then run the below commands.

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

Hope this helps.

OTHER TIPS

Rename module name

 module-ui

to

 Magento_Ui
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top