Tagged: Cart, Hide, shopping, woocommerce
-
AuthorPosts
-
May 9, 2016 at 6:12 am #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?
May 9, 2016 at 5:07 pm #629363Hey 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,
JordanMay 9, 2016 at 8:23 pm #629461It 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.
- This reply was modified 8 years, 6 months ago by mydoo.
May 10, 2016 at 6:01 pm #630155And off course not with CSS else logged in users cannot see it.
May 11, 2016 at 11:16 am #630597Hi,
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,
AndyMay 11, 2016 at 4:15 pm #630807Hi,
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,
May 11, 2016 at 4:22 pm #630815Hey!
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,
YigitMay 11, 2016 at 4:30 pm #630820Anyway 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?
Does this not go away during an update of the theme?
- This reply was modified 8 years, 6 months ago by mydoo.
-
AuthorPosts
- The topic ‘Hide WooCommerce Add To Cart for guest only’ is closed to new replies.