I need to get values from function Woocommerce. So I want the values display out of the function. Is there another simple solution to solve it?
WooCommerce.get('products?per_page=100', function(err, data, res) {
var data = JSON.parse(res);
var id = data[0]['id'];
});
console.log(id); // output is undefined