Hide menu cart for logged out users completely
-
Hello,
I want to hide/disable the menu cart for logged out users, only logged in users can view the menu cart. The solutions you provided before were not 100% effective. After applying your code the woocommerce menu bar cart is not visible but parts of the menu item container is still visible. The empty menu item is still visible without the cart content and my visitors are still able to click on the menu even when the cart is not showing.
This was the css and php code you provided earlier but it’s not very effective.
:not(.logged-in) .wpmenucartli {
display: none;
}add_filter(‘wpmenucart_menu_item_a_content’, ‘wpmenucart_only_logged_in’, 10, 4);
function wpmenucart_only_logged_in( $link_content, $menu_item_icon, $cart_contents, $item_data ) {
if (!is_user_logged_in()) {
$link_content = ”;
}
return $link_content;
}Thanks
- The topic ‘Hide menu cart for logged out users completely’ is closed to new replies.