How to hide the prices of product variants
-
Hi,
I would like to hide the prices of product variants. I have a code that works, but it also hides the price range on category pages. Do you know how to modify this code so that it works only within product pages, not categories? I would greatly appreciate your help.
function patricks_custom_variation_price( $price, $product ) {
$target_product_types = array(
'variable'
);
if ( in_array ( $product->product_type, $target_product_types ) ) {
// if variable product return and empty string
return '';
}
// return normal price
return $price;
}
add_filter('woocommerce_get_price_html', 'patricks_custom_variation_price', 10, 2);Best regards,
Ola
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.