DISABLE VARIABLE PRODUCT PRICE RANGE - by timlim

This topic has 14 replies, 4 voices, and was last updated 9 years, 10 months ago ago by Robert Hall

  • Avatar: timlim
    timlim
    Participant
    February 19, 2016 at 10:42

    The same post ‘Disable Variable Product Price Range’ is closed to new replies, thus i start a new one here.

    I’m having the same issue on variable product, I just need to display either one price instead of price range.

    Here is my wordpress and FTP details.

    Please, contact administrator
    for this information.
    13 Answers
    Avatar: Robert Hall
    Robert Hall
    Participant
    February 19, 2016 at 10:49

    Hello,

    Please try to add this code in custom.css file

    .single-product-page .product-info .price {
        display:none;
    }

    Here is a video tutorial how to create custom.css: https://www.youtube.com/watch?v=Qok2zRedRMY&feature=youtu.be.

    Regards,
    Robert Hall.

    Avatar: timlim
    timlim
    Participant
    February 19, 2016 at 10:55

    I did but it doesn’t works.

    Avatar: Robert Hall
    Robert Hall
    Participant
    February 19, 2016 at 11:22

    The code above should hide the price on single product page. See screenshot: http://prntscr.com/a583o7
    As I see you didn’t created a custom.css file.
    You need rename default.custom.css file to custom.css then add code there.

    Regards,
    Robert Hall.

    Avatar: timlim
    timlim
    Participant
    February 19, 2016 at 11:51

    Hi Robert,

    Yes, it works on single product page. What about on product listing?
    Can I just have it to display a single price while i’ve selected only 1 default product?
    http://atrefine.com/atrefine.com/Main%20Page.jpg
    http://atrefine.com/atrefine.com/product%20listing.jpg

    Avatar: Robert Hall
    Robert Hall
    Participant
    February 19, 2016 at 13:44

    In this case you can try to add this code into function.php file of the Child Theme.

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

    Regards,
    Robert Hall.

    Avatar: timlim
    timlim
    Participant
    February 19, 2016 at 17:05

    Hi Robert,

    Where is the file and how? Could you guide me?

    Avatar: Eva
    Eva Kemp
    Participant
    February 19, 2016 at 17:38

    Hello,

    At first you need create child theme as described here:
    http://codex.wordpress.org/Child_Themes
    Then activate it in Appearance > Themes and add the code in Appearance > Editor > functions.php file.

    Regards,
    Eva Kemp.

    Avatar: timlim
    timlim
    Participant
    February 20, 2016 at 12:41

    I’ve added the code above to functions.php of the child theme, but now my site keeps refreshing non stop (I’m using mac Safari). Firefox and chrome are fine.

    Besides, how can i display the max price instead of min price? or is there a way to display the price of selected “Default Form Values:”?

    Avatar: Eva
    Eva Kemp
    Participant
    February 21, 2016 at 09:58

    Hello,

    As I see your site is working fine.
    You may try the code described in the article:
    http://businessbloomer.com/disable-variable-product-price-range-woocommerce/
    Sorry, but there is no way to display price of selected “Default Form Values:”. You may contact Woocommerce support concerning this query.

    Regards,
    Eva Kemp.

    Avatar: timlim
    timlim
    Participant
    February 21, 2016 at 11:28

    Both of my safari browser from iOS and Mac OS also have the problem – keep refreshing.

    Is there a way of displaying the max. price instead of min. price?

    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    February 22, 2016 at 10:34

    Hello,

    The issue with reloading has been fixed. Clear browser cache and check.
    I’ve added this code in child functions.php file to show max price:

    add_filter('woocommerce_variable_price_html', 'custom_variation_price', 10, 2);
    
    function custom_variation_price( $price, $product ) {
    $price = '';
    
    if ( $product->max_variation_price && $product->max_variation_price !== $product->min_variation_price ) {
    $price .= '<span class="to"> ' . _x('', 'max_price', 'woocommerce') . ' </span>';
    
    $price .= woocommerce_price($product->max_variation_price);
    }
    
    return $price;
    }

    Please check.

    Best regards,
    Jack Richardson.

    Avatar: timlim
    timlim
    Participant
    February 22, 2016 at 11:19

    Works great now!
    thank you so much!

    Avatar: Robert Hall
    Robert Hall
    Participant
    February 22, 2016 at 11:25

    Hello,

    You’re welcome!

    Regards,
    Robert Hall.

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

The issue related to '‘DISABLE VARIABLE PRODUCT PRICE RANGE’' has been successfully resolved, and the topic is now closed for further responses

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