• dear all,

    I am using the below code in functions in a child theme to hide the price range on product page which works well but the problem is , it is hiding actual price for FEW of the variable products for example for https://sab1000.de/product/textmarker-stabilo/. Kindly suggest how can I get that price back ?

    //Hide “From:$X”
    add_filter('woocommerce_get_price_html', 'lw_hide_variation_price', 10, 2);
    function lw_hide_variation_price( $v_price, $v_product ) {
    
    	if ( is_product() ) {
    
    		$v_product_types = array( 'variable');
    		if ( in_array ( $v_product->product_type, $v_product_types ) && !(is_shop()) ) {
    		return '';
    
    	}
    
    }
    // return regular price
    return $v_price;
    }

    Also please suggest how to keep the font size of the price in basket as original? With the css below actual price size is increased on product page but on the same product page the basket looks weird with the big Price font size

    .woocommerce.single-product span.amount {
    font-size: 1.7em!important ;
    }

    Thanks a lot.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Saif

    (@babylon1999)

    Hello @sabahath,

    I understand you want to remove the price range on variable products.

    May I ask why you didn’t solve this issue with CSS too? Fewer lines of code & headaches in my opinion. ??

    Example:

    /*  REMOVE PRICE RANGE FROM VARIABLE PRODUCTS  */
    
    .product-type-variable .price {
      display: none !important;
    }

    As for increasing the price font, you can add the following snippet:

    /*  Make Pirce on cart bigger  */
    
    .woocommerce-Price-amount {
      font-size: 1.7em !important;
    }

    Hope this helps!

    Thread Starter sabahath

    (@sabahath)

    Hello Saif ,

    yes I didn’t change with css because css is removing the complete price on product page . With the php , after selecting the variable product its relevante price is being displayed at product page but for 2 products this php is not working do you have any idea how to show the price for those variable products ?

    For understanding :below mentioned both are variable products in https://www.sab1000.de

    Variable product 1. :Batterien Duracell AA (PHP WORKS WELL :RELEVANT PRICE IS DISPLAYED AFTER SELECTING THE PRODUCT )

    But in Variable product 2.:Textmarker Stabilo Boss ,(NO PRICE IS DISPLAYED AT PRODUCT PAGE ) HOW TO GET THE RELEVANT PRICE THERE ?

    both are variable products but php is not working for Variable product 2

    And regarding the font size of PRICE in header basket I DONT WANT the price font size bigger there … BUT WANT THE FONT SIZE INCREASED beside the product image.How to change the css ? so that it should not effect the price font size in header basket ?

    Please suggest

    Thanks

    Thread Starter sabahath

    (@sabahath)

    Dear Saif, please set this ticket as resolved , I found the reason , just set the price to sale for one variable product and see it works thanks a lot

    Hi @sabahath

    I’m glad you were able to find a solution to your inquiry here and thanks for sharing it with the community too! ??

    Meanwhile, if you have a few minutes, we’d love it if you could leave us a review:

    https://www.ads-software.com/support/theme/storefront/reviews/

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Hide price range on product page’ is closed to new replies.