Overriding a module JavaScript asset from a (child) theme
Still with the whrelaycarrier
module, let’s trigger an alert displaying the Thanks for the choice! message on a pickup relay line click, on the modal box. The expected behavior would look like this:
Figure 15.5 – The alert box displayed on a pickup point line click after the ajax process
As a reminder, the JavaScript code defining the modal box behavior can be found in the /
modules/whrelaycarrier/views/js/checkout.js
file.
By following the same method presented in the previous sections, for both templates and CSS file overrides, if we create a /themes/childclassicwh/modules/whrelaycarrier/views/js/checkout.js
file, it will replace the original JavaScript file and will be executed instead.
So, let’s do it and copy and paste the original JavaScript content and replace the $('#whrelaycarrier_points>div>ul>li').click(function(){…})
selector event...