0

I'm trying to override from my child theme some JavaScript, which is in a parent theme's .js file. The file in question is not being loaded through a PHP hook, but rather from within another .js file (the parent theme's main scripts.js file) full of //@prepros-prepend commands calling other .js files, including the one I want to override, with relative paths like so:

//@prepros-prepend components/wc-product-gallery.js

I only need to change one true value to a false one inside an if statement in wc-product-gallery.js. I tried copying the relevant code into my child theme's custom-scripts.js that gets properly enqueued, but it doesn't override the parent theme's code.

I could, in theory, dequeue the parent theme's scripts.js and enqueue a modified version from the child theme, but then how do I go about the relative paths to make sure only one prepended file is loaded from the child theme directory, and all the other ones keep getting loaded from the parent theme, and at the right time as well?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.