Site logo

Archived topic

Shopping Cart icon

3 replies · Started by Frank on July 1, 2017

Viewing posts 1–4 of 4

Hi there, greetings!
How can I make it so the Shopping Cart icon is only visible to logged in users.
Can't find any option or solution.
THX in advance.
Frank.

Try this:

add_action( 'after_setup_theme', 'tu_user_only_shopping_cart_icon' );
function tu_user_only_shopping_cart_icon() {
    if ( ! is_user_logged_in() ) {
        remove_filter( 'wp_nav_menu_items','generatepress_wc_menu_cart', 10, 2 );
    }
}

Hi there,
The snippet does the trick.
THX for the help!
All the best.

You're welcome :)

This archived topic is closed to new replies.