I want to hide out of stock variation price from woocommerce variable products price-range
for example i have product that has 2 variation, one of them sold out but in price range it's still showing old price for sold out variation
i want to show price range only for available (in stock) variations
I searched a lot and did't find any solution Found this code
add_filter( 'woocommerce_get_price_html', 'remove_price_ofs', 10, 2 );
function remove_price_ofs( $price, $product ) {
if ( ! $product->is_in_stock() && (is_product() || is_product_category() || is_shop() )) {$price = '';}
return $price;
}
but it's only hide price from product itself, but in price range it's still showing out of stock variation price
Thanks all in advance for help!
source https://stackoverflow.com/questions/73521134/woocommerce-hide-out-of-stock-variation-price-from-variable-price-range

No comments:
Post a Comment