Remove variation price in Woocommerce

When I create a woocommerce product with variations such as a t-shirt with different sizes, the product page shows a “from” price. As the products all have the same prices I don’t need to display the from price. I just want to remove the from price and then when the user makes a choice in the selectbox, the price will appear.

How can I remove the variation price?

Related posts

Leave a Reply

3 comments

  1. Add this to functions.php

    add_filter('woocommerce_variable_price_html','custom_from',10);
    add_filter('woocommerce_grouped_price_html','custom_from',10);
    add_filter('woocommerce_variable_sale_price_html','custom_from',10);
    function custom_from($price){
        return false;
    }
    
  2. Just copy and paste below code for your theme function.php file.

    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);