Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #629003

    Is there a way too hide the Add too Cart on the overview page only for Guest and show it for logged in users?

    #629363

    Hey mydoo,

    Thanks for getting in touch with us!

    Please try placing the following code in the functions.php file of your Child Theme:

    
    add_filter('woocommerce_get_price_html', 'avia_show_cart_logged');
    
    function avia_show_cart_logged($cart){
    if(is_user_logged_in() ){
    return $cart;
    }
    else
    {
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
    }
    }
    

    Best regards,
    Jordan

    #629461

    It doens´t work when I turn on the template buttons in

    Enfold options

    Shop options – > Product layout on overview pages

    And then select: “standard”

    On the offline user page I see add too cart button. We need this too be only shown to logged in members of our website.

    null

    • This reply was modified 1 year, 6 months ago by  mydoo.
    #630155

    And off course not with CSS else logged in users cannot see it.

    #630597

    Hi,

    I am pretty sure there is a plugin out there for you with such a function. Otherwise I would ask in WooCommerce Support forum about it.

    Best regards,
    Andy

    #630807

    Hi,

    I am pretty sure it is controlled by the theme you made called Enfold under option in Shop Options you can control the buttons. So no mather what 3rd party codes I put it doesn´t work. So you are saying we are not going too support this? After we buy the license?

    Best regards,

    #630815

    Hey!

    Please go to enfold/config-woocommerce/config.php file and find

    if($output && !post_password_required() && '' == avia_get_option('product_layout',''))

    and change it to

    if($output && !post_password_required() && is_user_logged_in() && '' == avia_get_option('product_layout',''))

    Best regards,
    Yigit

    #630820

    Anyway I got the solution it does have to do with AVIA that is controlled by the theme Enfold:

    .avia_cart_buttons {
    display: none;
    }
    
    #top.logged-in .avia_cart_buttons {
    display: block;
    }

    For anyone that faces the same problem. Thanks for the support.

    Toppic is closed why?

    @yigit:

    Does this not go away during an update of the theme?

    • This reply was modified 1 year, 6 months ago by  mydoo.
Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Hide WooCommerce Add To Cart for guest only’ is closed to new replies.