• Resolved Healthyworkoutmeals

    (@healthyworkoutmeals)


    For my Webshop I have been looking to remove the price range shown when adding variable products. I have manged to remove the highest price and therefor the shop only displays the lowest price.

    This is good but I would really like to let my customer know this is the starting price. Is there a way to add text like “from” to the minimum price of the variable product?.

    I used this snippet:

    add_filter( 'woocommerce_variable_sale_price_html', 'hide_variable_max_price', PHP_INT_MAX, 2 );
    add_filter( 'woocommerce_variable_price_html',      'hide_variable_max_price', PHP_INT_MAX, 2 );
    function hide_variable_max_price( $price, $_product ) {
        $min_price_regular = $_product->get_variation_regular_price( 'min', true );
        $min_price_sale    = $_product->get_variation_sale_price( 'min', true );
        return ( $min_price_sale == $min_price_regular ) ?
            wc_price( $min_price_regular ) :
            '<del>' . wc_price( $min_price_regular ) . '</del>' . '<ins>' . wc_price( $min_price_sale ) . '</ins>';
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding "From" to variable products’ is closed to new replies.