Viewing 11 replies - 16 through 26 (of 26 total)
  • To Aimeevee:
    Thank you for the code!
    However, I placed it into the varibale.php file as you suggested, but it didn’t work ?? I looked for any other variable.php files I might have in my theme directory – but found none.
    What might be the problem?
    Can it conflict with the bheadrick’s suggestion? (because I left it in my theme’s functions.php file).
    What do you think?

    To Brad Smith:
    Thank you for your suggestion! I am currently looking at Register Plus Redux and New User Approve Plugins. As soon as I try one of them, I will post my review here.

    Ron Troyer

    (@ronrontroyercom)

    Hi
    Like Brad I would like to hide ALL pricing – even when the user is logged in. The shopping cart would still function as an ordering tool but billed or quoted per other means.

    So I still want the add to cart button to be usable.

    Does anyone know how I could modify this code from bheadrick?
    I do not need the “Login or Register to see price”

    add_filter('woocommerce_get_price_html','members_only_price');
    function members_only_price($price){
    if(is_user_logged_in() ){
        return $price;
    }
    else return '<a href="' .get_permalink(woocommerce_get_page_id('myaccount')). '">Login</a> or <a href="'.site_url('/wp-login.php?action=register&redirect_to=' . get_permalink()).'">Register</a> to see price!';
    }

    Hi,

    Linking back to the original piece of code provided by bheadrick. Its a great addition, and works a treat! The only little issue is that it only seems to work for simple products.

    We have many products on our site which are variable and require the user to select colour/size etc before it reveals the price and add to cart button. Is there anyway this code can be amended to take account for this? I really appreciate the posting of this code!

    I look forward to any replies…

    Rican UK

    bheadrick’s code works fine to hide the price but is there any way to hide add to cart for the users that are not logged in?
    aimeevee’s code doesnt seem to work

    I tried the first code and it worked great (bheadrick). But it still shows the price in the “cart” – any idea how to get rid of that too. They want people to be able to add things to a cart but not see the price.

    thanks!

    hello, I just came across this post ’cause I’m searching how to display again prices in woocommerce.

    I’m trying to do a simple store for a book which has many covers’ options. So I just needed the price to show once, not by every product.

    I did get to hide the prices, but then ALL the pricing (cart total, and subtotal as well) went away.

    As I’m really newby, I usually just use the display:none.
    But I’ve searched the woocommerce.css, my theme’s style and so on and can’t find where was the modification : /

    Does anyone can point which/where are the strings that control prices?

    the website is https://omundoculturaenatureza.com.br/?post_type=product

    thanks a lot for any help!

    HI,

    Code

    add_filter('woocommerce_get_price_html','members_only_price');
    function members_only_price($price){
    if(is_user_logged_in() ){
        return $price;
    }
    else return '<a href="' .get_permalink(woocommerce_get_page_id('myaccount')). '">Login</a> or <a href="'.site_url('/wp-login.php?action=register&redirect_to=' . get_permalink()).'">Register</a> to see price!';
    }

    working fine , but if user add product in cart,than price is viaible in cart page . how to hide product in cart also???

    OK thanks to all!!

    Its work for me the following:
    ( paste in the function.php )

    add_filter('woocommerce_get_price_html','members_only_price');
    function members_only_price($price){
    if(is_user_logged_in() ){
        return $price;
    }
    else return '<a href="' .get_permalink(woocommerce_get_page_id('myaccount')). '">Accede</a> o <a href="'.site_url('/wp-login.php?action=register&redirect_to=' . get_permalink()).'">Regístrate</a> para ver precios!'.remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' ).remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 ).remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ).remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
    }

    this hide price and add to cart button and all prices in site.. if I dont login of course..

    Thanks 2112,

    That code works great for all products!

    Just a little query: I seem to be getting ‘Login or Register to see price!1111’. Do you know what might be causing these 1111 to be appearing??

    Also, the short description/excerpt seems to have vanished. Is there some way to get this back?

    Thanks in advance!

    DS

Viewing 11 replies - 16 through 26 (of 26 total)
  • The topic ‘Hide Prices’ is closed to new replies.