[Resolved] Cart Icon / Search Icon Secondary Menu

Home Forums Support [Resolved] Cart Icon / Search Icon Secondary Menu

Home Forums Support Cart Icon / Search Icon Secondary Menu

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #2168161
    tolis

    hello, i have put cart icon and search icon to the secondary menu which is above primary menu but on mobile i have hide the secondary menu..how i can display the cart icon and search icon to mobile in primary menu without losing on desktop the icons in secondary menu..

    Thanks in regards.

    #2168229
    Ying
    Staff
    Customer Support

    Hi Tolis,

    Can you try activate the navigation search at customizer > layout > primary navigation, and activate the cart at customizer > layout > Woocommerce?

    Once it’s done, do the cart and search icon appear in the primary navigation?

    If so, please link us to your site, we can add some custom CSS to hide them on desktop.

    If not, can you share the code of adding cart and search to secondary navigation here?

    #2168244
    tolis

    i have shared you the link. on desktop i am ok, just want to show the cart and search in mobile menu right to the logo ( not in off canvas menu)

    Thanks

    #2168254
    Ying
    Staff
    Customer Support

    Can you try the solution I mentioned in my last reply?

    #2168258
    tolis

    yeah i have them activated

    #2168264
    Ying
    Staff
    Customer Support

    So it doesn’t work.

    Can you share the code you are using which adds the icons to secondary navigation?

    #2168268
    tolis

    the code is

    add_filter( ‘generate_woocommerce_menu_item_location’, ‘tu_move_menu_cart_item’ );
    function tu_move_menu_cart_item() {
    return ‘secondary’;
    }

    and

    add_action( ‘wp’, function() {
    if ( ‘enable’ === generate_get_option( ‘nav_search’ ) ) {
    remove_action( ‘generate_menu_bar_items’, ‘generate_do_navigation_search_button’ );
    add_action( ‘generate_secondary_menu_bar_items’, ‘generate_do_navigation_search_button’ );

    remove_action( ‘generate_inside_navigation’, ‘generate_navigation_search’ );
    add_action( ‘generate_inside_secondary_navigation’, ‘generate_navigation_search’ );
    }
    }, 20 );

    #2168364
    Ying
    Staff
    Customer Support

    Try change your codes to this:

      add_filter( 'generate_woocommerce_menu_item_location', 'tu_move_menu_cart_item' );
             function tu_move_menu_cart_item() {    
    			 if (!wp_is_mobile()) {
                 return 'secondary';
             }   
    			 return 'primary';
    		 }	 
             add_action( 'wp', function() {
                      if ( 'enable' === generate_get_option( 'nav_search' ) && !wp_is_mobile() ) {
                               remove_action( 'generate_menu_bar_items', 'generate_do_navigation_search_button' );
                               add_action( 'generate_secondary_menu_bar_items', 'generate_do_navigation_search_button');
    
                               remove_action( 'generate_inside_navigation', 'generate_navigation_search' );
                               add_action( 'generate_inside_secondary_navigation', 'generate_navigation_search' );
                      }
             }, 20 );
    #2168568
    tolis

    yeah it worked thank you very much ๐Ÿ˜‰

    #2170124
    Ying
    Staff
    Customer Support

    You are welcome ๐Ÿ™‚

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.