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:
- Created and copied the files on
app/design/frontend/[VendorName]/[theme]/module-ui/web/js/form/element
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"?
2 Answers 2
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– Siva2019年04月24日 12:15:29 +00:00Commented Apr 24, 2019 at 12:15
-
It is your module name will reside in registration.php inside module-ui module, that should be placed therePrathap Gunasekaran– Prathap Gunasekaran2019年04月24日 13:16:50 +00:00Commented Apr 24, 2019 at 13:16
Rename module name
module-ui
to
Magento_Ui