We have technically infinite stock of the products, but I've added a large quantity as Lana indicated in this thread. Now at least when a variation that doesn't exist is selected, the add to bag button is hidden and "Out of Stock" appears for that combo.
I'm concerned that customer will interpret this to mean that we will eventually have stock for that variation of diameter and length, which isn't the case. What I'd like to do is disable the appropriate length radio buttons depending on which diameter is selected. I've found this post by smoothsailingclothing that seemed to be heading in the right direction.
Code:
<script> Ecwid.OnPageLoaded.add(function(page) { if ( page.type == "PRODUCT" ) { $.ajax({ url:'http://app.ecwid.com/api/v1/STOREID/product?id=' + page.productId, dataType: 'jsonp', success:function(json){ $.each(json.variations, function(index, product) { if ( product.quantity == 0 ) { $("#ecwid-productoption-" + page.productId + "-Size option:eq(" + index + ")").attr("disabled","disabled"); if ( (index+1) != json.variations.length ) { $("#ecwid-productoption-" + page.productId + "-Size").val(index+1).trigger('change'); } } }); } }); } }); </script>
Has anyone had any success with this?