'Show lowest sale price only for variable products but exclude single product page

Goal: I would like to display the lowest sale price for all variable products only everywhere except the single product page.

Context: I create a custom page for showing product listings (I don't use archive/category/shop pages from Woocommerce) and I want to display lowest saleprice and hide price range for all variable product listings. However, on the single product page, I prefer leaving it as default.

I'm a no-coder so I discovered some code snippets but could not achieve on my own.

 add_filter('woocommerce_variable_price_html', 'custom_variation_price', 10, 2);
function custom_variation_price( $price, $product ) {
    if ( ! empty($product->min_variation_price) && is_product_category() ) {
        $price = '<span class="from">' . _x('From', 'min_price', 'woocommerce') . ' </span>';
        $price .= woocommerce_price($product->get_price());
    }

    return $price;
}

    //Hide Price Range for WooCommerce Variable Products
add_filter( 'woocommerce_variable_sale_price_html', 
'lw_variable_product_price', 10, 2 );
add_filter( 'woocommerce_variable_price_html', 
'lw_variable_product_price', 10, 2 );

function lw_variable_product_price( $v_price, $v_product ) {

// Product Price
$prod_prices = array( $v_product->get_variation_price( 'min', true ), 
                            $v_product->get_variation_price( 'max', true ) );
$prod_price = $prod_prices[0]!==$prod_prices[1] ? sprintf(__('From %1$s', 'woocommerce'), 
                       wc_price( $prod_prices[0] ) ) : wc_price( $prod_prices[0] );


if ( $prod_price !== $regular_price ) {
$prod_price = '<del>'.$regular_price.$v_product->get_price_suffix() . '</del> <ins>' . 
                       $prod_price . $v_product->get_price_suffix() . '</ins>';
}
return $prod_price;
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source