I need to override Magento\Sales\view\adminhtml\web\js\order\create\scripts.js
via requirejs-config.js
in Magento 2?
-
1If the answer is useful and it is really suggested to other than accept it. So other people also know which answer is useful. I used Mayank zalavadia's answer and its working for me. – Dhaduk Mitesh Mar 8 '18 at 7:15
Create require-js.config
file at [Namespace]/[Module]/view/frontend/require-js.config and add following code on that file.
var config = {
map: {
'*': {
"customscripts": "[Namespace]_[Module]/js/customscripts",
"Magento_Sales/js/order/create/scripts": "[Namespace]_[Module]/js/customscripts",
}
}
};
And create customscripts.js
file at [Namespace]/[Module]/view/frontend/web/js/customscripts.js
And make sure you have added sequence
in your module.xml
file.
<sequence>
<module name="Magento_Sales"/>
</sequence>
That's it.
-
1@Ramanathan please follow as per I mention here. And I am sure you'll definitely able to override js. – user53816 Mar 8 '18 at 6:54
I think it will help you.
For your reference : Extending / Overriding JS in Magento 2
You can override js using following code in [Namespace]/[Module]/view/frontend/require-js.config
var config = {
map: {
'*': {
'Magento\Sales\view\adminhtml\web\js\order\create\scripts.js':'[Namespace]_[Module]/js/your-js-file'
}
}
};
Remember that you must not write .js for your file name. Don't forget to run following commands after it ;
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
php bin/magento cache:flush