global $product;
$variations = $product->get_available_variations();
$varstock = false;
foreach($variations as $variation){
$variation_id = $variation['variation_id'];
$variation_obj = new WC_Product_variation($variation_id);
$stock = $variation_obj->get_stock_quantity();
if($stock) {
$varstock = true;
break;
}
}
if($varstock) {
echo "В наличии";
}