[Support request] How to remove price range display on product overview page?

Home Forums Support [Support request] How to remove price range display on product overview page?

Home Forums Support How to remove price range display on product overview page?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1071220
    Jesper

    Hi
    I use wooocommerce, how to remove price range display on product overview page for variance products?
    Thanks
    Jesper

    #1071444
    Leo
    Staff
    Customer Support

    Hi there,

    Have you figured this out?

    Just checked your page and don’t think I’m seeing it anywhere.

    Let me know ๐Ÿ™‚

    #2087251
    Paul

    Hey,
    for anybody who it may concern, I found this code:

    //Remove Price Range
    add_filter( 'woocommerce_variable_sale_price_html', 'detect_variation_price_format', 10, 2 );
    add_filter( 'woocommerce_variable_price_html', 'detect_variation_price_format', 10, 2 );
    function detect_variation_price_format( $price, $product ) {
    // Main Price
    $prices = array( $product->get_variation_price( 'min', true ), $product->get_variation_price( 'max', true ) );
    if ($prices[0] !== $prices[1]) {
    $price = $prices[0] !== $prices[1] ? sprintf( __( '', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );
    }
    // Sale Price
    $prices = array( $product->get_variation_regular_price( 'min', true ), $product->get_variation_regular_price( 'max', true ) );
    sort( $prices );
    $saleprice = $prices[0] !== $prices[1] ? sprintf( __( '', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );
    if ( $price !== $saleprice ) {
    $price = '<del>' . $saleprice . '</del> <ins>' . $price . '</ins>';
    }
    return $price;
    }

    from
    https://annaschneider.me/hide-the-price-range-for-woocommerce-variable-products/

    I just added it to my child-theme and it works.

    #2087665
    Leo
    Staff
    Customer Support

    GLad to hear and thanks for sharing ๐Ÿ™‚

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.