Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hi!
    You can do this with a filter in your theme functions (functions.php):

    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;
    	}
    }

    If you haven’t edited functions.php before, make sure to read this page.

    Let me know if you have any other questions!

    Thread Starter billhi

    (@billhi)

    Thank you. I’ll try it.

    Plugin Contributor Ewout

    (@pomegranate)

    If anyone else is looking to do this, you can also hide the item with CSS (which is a bit more fool-proof). Add this to your themes custom styles:

    :not(.logged-in) .wpmenucartli { display: none !important; }

    Ewout

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Enable cart only if logged in?’ is closed to new replies.