Viewing 9 posts - 1 through 9 (of 9 total)
  • #142480
    muranoeyewear
    Member
    Post count: 81

    Hi

    Is there a way of hiding the price unless logged in i currently dont have it displayed on my product page but it is still appearing in the basket drop down and the basket its self.

    Thanks

    Ryan

    #142513
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please just paste this code at funtions.php of child theme.

    <?php 
    add_filter('woocommerce_get_price_html','members_only_price');
    function members_only_price($price){
    if(is_user_logged_in() ){
        return $price;
    }else{
     return true;
    }
    }
    ?>
    #142608
    muranoeyewear
    Member
    Post count: 81

    Hello again thank-you for the quick reply but i apologise i have managed to find a little bit of a simpler solution but i just need a hand in disabling the drop down price if that is at all possible?

    Thank you

    Ryan

    #142617
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    I am not sure about it. It would be better to ask at Woocommerce forum.
    Thanks
    Mohammad

    #142927
    muranoeyewear
    Member
    Post count: 81

    Hi again

    I have been unable to find anything across woocommerce forums relating to removing unit price from the drop down cart if you could help in anyway i would be very grateful.

    Thank You

    Ryan

    #142960
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Hi,

    But you only want to remove it for non logged in users I guess?
    Any reason to show the Add to cart button if the customer is not logged in?

    It’s easier to disable the Add to cart button when the user is not logged in.

    -Rui

    #143116
    muranoeyewear
    Member
    Post count: 81

    Hi

    Thanks ok would you be able to tell me how to disable the add to cart button for non customers?

    Will the affect viewing variations at all?

    Thanks

    Ryan

    #143353
    muranoeyewear
    Member
    Post count: 81

    sorry i ahvnt heard anything i was just wondering whether you could help with makiing the add to cart button only available to logged in customers?

    Thanks

    Ryan

    #143376
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Hi,

    Try to add this code to the functions.php

    
    if ( !is_user_logged_in() ){
    
    function remove_loop_button(){
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
    }
    add_action('init','remove_loop_button');
    
    }

    -Rui

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register