Hide Cart Button Only for non logged in users
-
Good Morning World,
I’m looking for some assistance if possible. I’m trying to hide the add to cart button (only button) for non logged in users however I do have a free sample button which links to this so every time I hide this it removes everything.
I am using the Elementor builder and Hello Theme.
I have tried:
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 );
—————————–
.add_to_cart_button {
display: none;
}
// Returns the add to cart button on the shop/category pages for logged in visitors
.logged-in .add_to_cart_button {
display: inline-block;
}
// Hides the add to cart button on the single product pages for all visitors
.single_add_to_cart_button {
display: none;
}
// Returns the add to cart button on the single product pages for logged in visitors
.logged-in .single_add_to_cart_button {
display: inline-block;
}But not having much look, any help would be appreciated.
Thanks in advance
- The topic ‘Hide Cart Button Only for non logged in users’ is closed to new replies.