1

I would like to hide the Subscription product variation details "From: $38.50 / month for 12 months and a $50.00 sign up fee" I need a code to disable.

I've tried other snippets which hide the word "from" or changed the verbiage of "sign up fee".

/*
 * Disable Variable Product Price Range completely:
**/

add_filter( 'woocommerce_variable_sale_price_html', 'my_remove_variation_price', 10, 2 );
add_filter( 'woocommerce_variable_price_html', 'my_remove_variation_price', 10, 2 );

function my_remove_variation_price( $price ) {
    $price = '';
    return $price;
}

The code works only for default WooCommerce products but not with subscription products.

I expect "From: $38.50 / month for 12 months and a $50.00 sign up fee" to be hidden.

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399

1 Answers1

1

The following will hide the price range from variable subscription products:

add_filter( 'woocommerce_get_price_html', 'hide_price_html_for_variable_subscription', 10, 2 );
function hide_price_html_for_variable_subscription( $price, $product ){
    if ( $product->is_type('variable-subscription') ) {
        $price = '';
    }
    return $price;
}

Code goes in functions.php file of your active child theme (or active theme). Tested and works.

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399