Today we are going to talk about how to Override core Javascript files in Magento 2 in your own custom module.
We had a requirement to add custom attribute to checkout which we are not covering in this post but we will talk about how to override Magento_Checkout/js/model/shipping-save-processor/default Magento 2 core Javascript file in your own custom module. The similar way you can override any of the Magento 2 core Javascript file.
Let’s get started to override core javascript in Magento 2-:
Step 1: Create requirejs-config.js under ScommerceCustomviewfrontend folder with the following code
Step 3: Once you have finished the above two steps then you need to make sure you run the following command for your site to pick up your overridden Javascript file instead of the original Magento 2 core Javascript file.
bin/magento setup:static-content:deploy
That’s it, Hope this article helped you in some way. Please leave us your comment and let us know what do you think? Thanks.