diff --git a/src/get-products.php b/src/get-products.php index acbd397..ffef9b8 100644 --- a/src/get-products.php +++ b/src/get-products.php @@ -255,13 +255,21 @@ } }); - servingOrTypeSet.forEach(function(servingOrType) { - $('#servingOrTypeGroup').append(''); - }); + if (servingOrTypeSet.size > 0) { + servingOrTypeSet.forEach(function(servingOrType) { + $('#servingOrTypeGroup').append(''); + }); + } else { + $('#servingOrTypeGroup').append('No variations available'); + } - flavorOrSizeSet.forEach(function(flavorOrSize) { - $('#flavorOrSizeGroup').append(''); - }); + if (flavorOrSizeSet.size > 0) { + flavorOrSizeSet.forEach(function(flavorOrSize) { + $('#flavorOrSizeGroup').append(''); + }); + } else { + $('#flavorOrSizeGroup').append('No variations available'); + } $('#defaultServingOrType').val(defaultServingOrType); $('#defaultFlavorOrSize').val(defaultFlavorOrSize); @@ -439,3 +447,4 @@ function calculateSubtotal() { }); +