Product detail is showing price range rather than base price

This topic has 4 replies, 3 voices, and was last updated 5 years, 3 months ago ago by Olga Barlow

  • Avatar: Tony
    Tony
    Participant
    August 2, 2019 at 03:55

    How can I show the base product price instead of a range:

    https://puu.sh/E0eir/76ce861fc4.png

    3 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    August 2, 2019 at 07:18

    Hello,

    Read this topic https://www.8theme.com/topic/product-variations-price-display/ If this is not what you are looking for, contact the support of woocommerce to get advice, because the additional customization is outside the scope of our support.

    Regards

    Avatar: Tony
    Tony
    Participant
    August 2, 2019 at 14:14

    I was looking for the reverse of this but I found this code to place in functions.php which worked:

    function wc_varb_price_range( $wcv_price, $product ) {
     
        $prefix = sprintf('%s: ', __('From', 'wcvp_range'));
     
        $wcv_reg_min_price = $product->get_variation_regular_price( 'min', true );
        $wcv_min_sale_price    = $product->get_variation_sale_price( 'min', true );
        $wcv_max_price = $product->get_variation_price( 'max', true );
        $wcv_min_price = $product->get_variation_price( 'min', true );
     
        $wcv_price = ( $wcv_min_sale_price == $wcv_reg_min_price ) ?
            wc_price( $wcv_reg_min_price ) :
            '<del>' . wc_price( $wcv_reg_min_price ) . '</del>' . '<ins>' . wc_price( $wcv_min_sale_price ) . '</ins>';
     
        return ( $wcv_min_price == $wcv_max_price ) ?
            $wcv_price :
            sprintf('%s%s', $prefix, $wcv_price);
    }
     
    add_filter( 'woocommerce_variable_sale_price_html', 'wc_varb_price_range', 10, 2 );
    add_filter( 'woocommerce_variable_price_html', 'wc_varb_price_range', 10, 2 );
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    August 2, 2019 at 15:05

    Hello,

    We are glad to hear that you sorted out.

    Regards

  • Viewing 4 results - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.