[Resolved] Shopping Cart Icon in Secondary Menu

Home Forums Support [Resolved] Shopping Cart Icon in Secondary Menu

Home Forums Support Shopping Cart Icon in Secondary Menu

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #358576
    antware

    Is it possible to place the Shopping Cart Icon in Secondary Menu instead of the Primary menu. Thanks guys.

    #358605
    Leo
    Staff
    Customer Support

    Hi there,

    Are you using either navigation search or sticky navigation in the primary menu?

    If not it’s probably either to just switch the primary and secondary as they have basically the same options.

    If not we might have to use the generate_inside_secondary_navigation hook: https://docs.generatepress.com/article/generate_inside_secondary_navigation/

    Will ask Tom to confirm 🙂

    #372029
    Jim

    Hi, did anyone resolve the issue of moving/adding the Cart icon to the secondary menu? I’ve tried swapping the primary and secondary menus but the automated ‘Display cart in menu’ remains in the primary (lower) bar.
    I can use a Font Awesome icon. However, you don’t get the benefit of seeing the running total beside the icon?

    #372114
    Tom
    Lead Developer
    Lead Developer

    I’ve just added a filter to the location for the next GPP version.

    For now, you could do this:

    add_filter( 'wp_nav_menu_items', 'tu_secondary_wc_menu_cart', 10, 2 );
    function tu_secondary_wc_menu_cart( $nav, $args ) {
    	// If our primary menu is set, add the search icon
    	if ( $args->theme_location == 'secondary' && function_exists( 'generatepress_wc_cart_link' ) ) {
    		return sprintf( 
    			'%1$s 
    			<li class="wc-menu-item %4$s" title="%2$s">
    				%3$s
    			</li>',
    			$nav,
    			esc_attr__( 'View your shopping cart','generate-woocommerce' ),
    			generatepress_wc_cart_link(),
    			is_cart() ? 'current-menu-item' : ''
    		);
    	}
    	
    	// Our primary menu isn't set, return the regular nav
        return $nav;
    }
    #372478
    Jim

    Brilliant as always Tom.

    Many thanks.

    J

    #372725
    Tom
    Lead Developer
    Lead Developer

    You’re welcome 🙂

    #762912
    webcréateur

    Hi.

    Is this post still up to date or is there a “better” solution for this inquiry?

    Best regards.

    #763064
    David
    Staff
    Customer Support
    #763069
    webcréateur

    Hi David.

    Thank you very much. 🙂

    Best regards.

    #763090
    David
    Staff
    Customer Support

    You’re welcome

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