1

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"?

1

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.

  • Thanks. Could you please explain why we need to change the module name from module-ui to Magento_Ui? – Siva Apr 24 at 12:15
  • It is your module name will reside in registration.php inside module-ui module, that should be placed there – Prathap Gunasekaran Apr 24 at 13:16
1

Rename module name

 module-ui

to

 Magento_Ui
  • Thanks for the information. It works perfectly. – Siva Apr 24 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.