15/08/2022
We use cookies to make your experience better. To comply with the new e-Privacy directive, we need to ask for your consent to set the cookies. Learn more.
We use cookies to make your experience better. To comply with the new e-Privacy directive, we need to ask for your consent to set the cookies. Learn more.
To override the JS file in Magento 2
Directory
app\code\VendorName\ModuleName\registration.php
Content of registration.php
<?php
\Magento\Framework\Component\ComponentRegistrar::register(\Magento\Framework\Component\ComponentRegistrar::MODULE, 'VendorName_ModuleName', __DIR__);
Directory
app\code\VendorName\Namespace\etc\module.xml
Content of module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="VendorName_ModuleName" setup_version="1.0.0"/>
</config>
Directory
app\code\VendorName\ModuleName\view\frontend\requirejs-config.js
Content of requirejs-config.js
var config =
{
map:
{
'*':
{
'Magento_Checkout/js/action/place-order':'VendorName_ModuleName/js/action/place-order'
}
}
};