Trigger a JavaScript function based on the data fetched from Woo commerce hook

After going through a lot of articles and solutions I finally figured it out: Directory Structure for the plugin (Boilerplate directory structure used from here) First step: Register a js script which would track the event/ user activity and pass it the ajax URL through which it would fetch the product details via ajax. // … Read more

Theme path of WordPress inside javascript file

You don’t seem to have a trigger for your JS. You can test that the script is actually running by adding a quick console, such as console.log(‘xyz.js is running’); Once you’re sure your JS is running, you can add a trigger. If you’re already loading jQuery, it has an easy .ready() function to use, but … Read more