- This topic has 11 replies, 5 voices, and was last updated 5 years, 4 months ago by David.
-
AuthorPosts
-
March 16, 2018 at 1:58 am #521334Fahmi
Hi.
I am using Conditional Menu by Themify with GPP.
I had 2 menu for Primary Menu NavBar.
For WooCommerce page, I am using an alternative menu different from the home page menu.
It seem that WooCommerce Cart Menu item won’t display on the alternative menu. But it will display just fine on the other one.
Is there anything I can to to fixed this?
March 16, 2018 at 9:13 am #521706LeoStaffCustomer SupportHi there,
Have you checked with the plugin support for this issue?
Can you link us to the site in question?
You can edit the original topic and use the private URL field.
March 16, 2018 at 10:09 pm #522133FahmiI am sorry for my late reply.
I have update my first post.
The woocommerce shop section is still hidden with no link to shop section. You will have to type manually the url since I still not put the link menu to shop section.
March 17, 2018 at 9:42 am #522441LeoStaffCustomer SupportI’m not able to find the WooCommerce page? All the menu links on the home page are anchors.
Let me know.
March 17, 2018 at 11:16 am #522496FahmiI am sorry.
I have update my web link to shop section.
March 17, 2018 at 9:03 pm #522754TomLead DeveloperLead DeveloperHi there,
The WC menu item will only be added to the “primary” theme menu location.
You can adjust it like this:
add_filter( 'generate_woocommerce_menu_item_location', 'tu_conditional_wc_menu_item' ); function tu_conditional_wc_menu_item() { return array( 'primary', 'another-location', 'one-more', ); }
Hope this helps ๐
March 17, 2018 at 10:56 pm #522785FahmiHi Tom, thank you for your time.
I have been tinkering with the code for some time.
But it does not help.add_filter( 'generate_woocommerce_menu_item_location', 'tu_conditional_wc_menu_item' ); function tu_conditional_wc_menu_item() { return array( 'primary', 'secondary' ); }
When I try using the code above, WooCommerce Cart Menu item is not display at all.
So I have removed the the code.—
I had 2 menu which is ‘Home Menu’ & ‘Shop Menu’.
‘Home Menu’ is set to primany menu location by default.
‘Shop Menu’ is an alternative menu that will only be displayed on WooCommerce related page.‘Shop Menu’ does not have location.
But base on the condition set, Conditional Menu plugin will replace the whole ‘Home Menu’ itself with ‘Shop Menu’.
As right now, WooCommerce Cart Menu will be display on all page that use ‘Home Menu’ but will not display on WooCommerce related page which right now use ‘Shop Menu’.
—
I guest it’s not working because of how the plugin work.
For now I will try to look for other way to do this.
Thank you again for your time.
March 18, 2018 at 8:14 pm #523355TomLead DeveloperLead DeveloperAh, my mistake – there can only be one value.
You can add the item to all menus like this:
add_filter( 'wp_nav_menu_items', 'tu_wc_menu_cart', 10, 2 ); function tu_wc_menu_cart( $nav, $args ) { // If our primary menu is set, add the search icon if ( function_exists( 'generatepress_wc_cart_link' ) && function_exists( 'is_cart' ) ) { 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' : '' ); } return $nav; }
March 19, 2018 at 12:52 am #523436FahmiWooCommerce Cart Menu item is now display on Primary Menu even after it being replace when by conditional menu plugin.
First we need to untick Display cart in menu option from theme customizer Appearance > Customize > Layout > WooCommerce. If not then we would have 2 WooCommerce Cart Menu item on Primary Menu.
After that it all working fine.
Thank you Tom.
March 19, 2018 at 9:57 am #523817TomLead DeveloperLead DeveloperYou’re welcome ๐
November 25, 2018 at 8:42 pm #739257TullyHi guys, I am wanting to do the same thing. Where do I add this code?
Thanks, Tully
November 26, 2018 at 3:13 am #739550DavidStaffCustomer SupportHi there,
the code is PHP, this article covers the methods of adding:
-
AuthorPosts
- You must be logged in to reply to this topic.