I've got a JS code that gives us a product stock amount from another provider for our client.
But how do I embed the JS jQuery on a single WooCommerce product?
var settings = {
"url": "https://www.URL.com",
"method": "GET",
"timeout": 0,
"headers": {
"client-secret": "password123"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Tried adding it to our theme's header script but with no success.
No experience with JS so any help is greatly appreciated.
Our provider mentioned it's required to be in the header, if that matters. Also is it possible to add an if $product string to only apply this script to certain products? We'd only need this script running on a handful of products.