• Resolved teeboy4real

    (@teeboy4real)


    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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter teeboy4real

    (@teeboy4real)

    Hello,

    I found a solution in previous support topics with this code you provided.

    add_filter( ‘wpmenucart_menu_item_wrapper’, ‘wpmenucart_hide_for_visitors’, 10, 1 );
    function wpmenucart_hide_for_visitors( $menu_item_li ) {
    if ( is_user_logged_in() ) {
    return $menu_item_li;
    } else {
    return;
    }
    }

    Thanks

    Plugin Contributor Ewout

    (@pomegranate)

    Glad to hear you found a solution!

    Resolved!

    • This reply was modified 5 years, 8 months ago by José.
    • This reply was modified 5 years, 8 months ago by José.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hide menu cart for logged out users completely’ is closed to new replies.