Overriding Colocated Javascript for Page (not core module)

Hello all,

I am attempting to override a Javascript file in the Webshop plugin - changing the functionality of the “cart” page. The original “cart.js” file extends the “shopping cart” object with jQuery.extend(), so I figured I’d do the same, extending it to override the functions I wish to change. I made a new file in “[my_plugin]/public/js/override/cart.py”, then used web_include_js in the hooks.py file to implement my code.

However, it seems that the base.html is configured to load the hooks in web_include_js before the colocated Javascript file - so the original “cart.js” file in the same directory as “cart.html” is then run after my override, re-overriding it!

I attempted to fix this by using “page_js” instead, attempting to replace the Javascript for the “cart” page with my own code. This also failed, unexpectedly - it seems “page_js” is only for core pages.

Is there any way to override the colocated Javascript for a page that is not in the core - or failing that, to make the web_include_js run after the colocated Javascript?

Thanks in advance!