get_children()) > apply_filters( 'woocommerce_ajax_variation_threshold', 30, $product ) ); if ($should_use_ajax_variations) { return null; } $is_default_variation = false; $current_variation = null; foreach($product->get_available_variations() as $variation_values ) { foreach ($variation_values['attributes'] as $key => $attribute_value) { $attribute_name = str_replace( 'attribute_', '', $key ); $default_value = $product->get_variation_default_attribute($attribute_name); if ($default_value == $attribute_value) { $is_default_variation = true; } else { $is_default_variation = false; break; } } if ($is_default_variation ) { $variation_id = $variation_values['variation_id']; break; } } if ($is_default_variation) { $default_variation = wc_get_product($variation_id); $current_variation = $default_variation; } $maybe_variation = (new \WC_Product_Data_Store_CPT())->find_matching_product_variation( $product, $_GET ); if ($maybe_variation) { $current_variation = wc_get_product($maybe_variation); } return $current_variation; } }