Skip to content

Instantly share code, notes, and snippets.

@tiagomatos
Last active May 16, 2016 23:32
Show Gist options
  • Save tiagomatos/102ec5f414cedf0960a58537951c6a33 to your computer and use it in GitHub Desktop.
Save tiagomatos/102ec5f414cedf0960a58537951c6a33 to your computer and use it in GitHub Desktop.
Jumpseller's Javascript method: productVariantListener to display Product stock info
<script type="text/javascript">
// more info at: https://jumpseller.com/support/javascript-library
var callbackFunction = function(event, productInfo){
if(!$.isEmptyObject(productInfo)){
console.log(productInfo);
alert('stock: ' + productInfo.stock + ', stock unlimited?:' + productInfo.stock_unlimited);
}
};
//update Product information with current variant
Jumpseller.productVariantListener('select.prod-options', {product: '{{ product | json }}', callback: callbackFunction});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment