Hi tagDiv team,
I need to register a separate menu for woocommerce product pages which have their own categories (shop is an addition to an online magazine which has its own menu).
I’m following your guide here: https://forum.tagdiv.com/main-menu/ , but when I click on Create new menu, nothing happens. See here:
https://postimg.org/image/k133g1vlz/
This is not the biggest problem. I can’t edit my existing menu! Also, I can’t open the screen options. Actually, I can’t do anything on this page. It is inactive for some reason.
I would like to use the same mega menu for the Woocommerce pages that comes with the theme.
Please support.
Thanks!
Hello,
It seems your menus section is not working properly. It may be due to a plugin conflict.
Please disable all plugins except the page builder, clear cache and reset cdn files if you use it. Please also check any custom code you might have added to the theme panel or the theme files. If you use a child theme, please switch to the main theme to make sure it does not affect the proper functionality of the theme.
Thank you!
It was another plugin that caused the issue. It isn’t a common one, but a plugin from a local shipping agency that is a woocommerce addition.
I successfully created a new menu that includes woocommerce categories. I would like to display the new menu on all woocommerce category, tag and product pages. How is that possible?
Thanks
Hi,
That would require a lot of work and modifications to the theme, there is no options to switch menus based on pages or any other basis. The header supports only one menu for all the website. Maybe you can find a plugin that could have this capability, because any other way will not be easy, or think of another way of achieving something like that.
Thanks
On another forum I found this code as a potential solution, but when I paste it in the child theme’s function.php all pages on the site incl. non-commerce pages stop loading, only a white screen.
// =============================================================================
// Sets Custom Menu For WooCommerce Shop
// =============================================================================
add_filter( ‘wp_nav_menu_args’, ‘custom_blog_menu’ );
function custom_blog_menu( $args ) {
if ( x_is_product() || x_is_product_index() ) {
$args[‘theme_location’] = ‘primary’;
$args[‘menu’] = ‘Custom Menu’;
}
return $args;
}
Can it be modified to work properly?
Thanks
Hi,
Codes from other topics will probably not work in every situation. Themes do not share the same code and structure. You will have to make the modification specific for this theme. You need to register the new menu like this example
– https://www.screencast.com/t/DuXG6QMAj3b
– https://www.screencast.com/t/QNN4LY8ahh
Then create a condition in this file like this
– https://www.screencast.com/t/BrGgaDmC9Q
I have not tested this properly, but you can try it and see if it works for you. Here are some more conditional tags that you can try and test
– https://docs.woocommerce.com/document/conditional-tags/
Thanks
Thanks Simion, much appreciated! But it doesn’t work for some reason…
I created the path and copied the respective file in my child theme, then added the following line of code on the suggested place in the php code: ‘w-menu’ => ‘w menu’ but it breaks the site. To try, I added the code in the respective file, in the respective parent theme’s folder (as you describe above) – it breaks the site again.
I have the shop menu created, just can’t create a new location- woocommerce pages.
Btw, just as a note, in case that matters – I use the following code to avoid loading woocommerce scripts on non-woocommerce pages:
add_action( ‘wp_enqueue_scripts’, ‘dequeue_woocommerce_styles_scripts’, 99 );
function dequeue_woocommerce_styles_scripts() {
if ( function_exists( ‘is_woocommerce’ ) ) {
if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) {
# Styles
wp_dequeue_style( ‘woocommerce-general’ );
wp_dequeue_style( ‘woocommerce-layout’ );
wp_dequeue_style( ‘woocommerce-smallscreen’ );
wp_dequeue_style( ‘woocommerce_frontend_styles’ );
wp_dequeue_style( ‘woocommerce_fancybox_styles’ );
wp_dequeue_style( ‘woocommerce_chosen_styles’ );
wp_dequeue_style( ‘woocommerce_prettyPhoto_css’ );
# Scripts
wp_dequeue_script( ‘wc_price_slider’ );
wp_dequeue_script( ‘wc-single-product’ );
wp_dequeue_script( ‘wc-add-to-cart’ );
wp_dequeue_script( ‘wc-cart-fragments’ );
wp_dequeue_script( ‘wc-checkout’ );
wp_dequeue_script( ‘wc-add-to-cart-variation’ );
wp_dequeue_script( ‘wc-single-product’ );
wp_dequeue_script( ‘wc-cart’ );
wp_dequeue_script( ‘wc-chosen’ );
wp_dequeue_script( ‘woocommerce’ );
wp_dequeue_script( ‘prettyPhoto’ );
wp_dequeue_script( ‘prettyPhoto-init’ );
wp_dequeue_script( ‘jquery-blockui’ );
wp_dequeue_script( ‘jquery-placeholder’ );
wp_dequeue_script( ‘fancybox’ );
wp_dequeue_script( ‘jqueryui’ );
}
}
}
Thanks for your support!
Hi,
Maybe you are not using proper syntax in the code that is why the theme breaks. Try it exactly as shown as a test, and double check all the code. It should not break the website if done properly. Or maybe you can find another way to implement something like this, try searching online, maybe you can find similar topics with solutions to try.
Thanks
Hi,
Try adding the necessary conditional tags in the code like this
– https://www.screencast.com/t/LLbb1TktrQ3
Then check if it is working properly.
Thanks
Hi,
You will have to make the same modifications that you made in the header menu, in this file as well
– https://www.screencast.com/t/CDAfWBrvT
Try something like this
– https://www.screencast.com/t/T8gnlqVW
Thanks
Guys, it seems that there’s one more thing – the visual part. The styling (padding, capitalizing, hover effect etc.) of the drop down menus in the menu dedicated to woocommerce pages appear differently compared to the styling of the default drop down menu.
Please see here: http://imgur.com/a/UJ9VH
I need to fix this only for the desktop version of the menu.
Any help will be much appreciated.
Thanks.
Hi,
There seems to be a class missing form the menu, that is hwy it displays like that. Please check that where you made the modification in the code you have not modified that class here
– https://www.screencast.com/t/KLHLrEfT
I have tested this again and the sub-menu is displayed properly on Woocommerce pages
– https://www.screencast.com/t/73JVZiICNAir
It could be done with CSS but it would take a lot of code to make it look like it should.
Thanks
Hi,
here’s my code:
if (is_woocommerce() or is_cart() or is_checkout() ) {
wp_nav_menu(array(
‘theme_location’ => ‘w-menu’,
‘menu_class’=> ‘sf-menu’,
‘fallback_cb’ => ‘td_wp_page_menu’,
‘walker’ => new td_tagdiv_walker_nav_menu()
));}
else {
wp_nav_menu(array(
‘theme_location’ => ‘header-menu’,
‘menu_class’=> ‘sf-menu’,
‘fallback_cb’ => ‘td_wp_page_menu’,
‘walker’ => new td_tagdiv_walker_nav_menu()
));
}
It’s the same as yours, isn’t it?
I definitely need a solution for this as half of the traffic to the site is from desktop devices.
Thanks
Hi,
The modifications in the code seem to be in order. Please enter this code in Theme panel->Custom CSS and it will style the menu item in the shop
– https://www.screencast.com/t/WOykzrwvIdBQ
.menu-item-36318 li a{
padding: 7px 30px;
font-size: 14px;
line-height: 20px;
color: #111;
display: block;
position: relative;
}
.menu-item-36318 li a:hover {
color: #ffac99;
}
.menu-item-36318 ul {
padding: 15px 0;
}
Thanks
Hi,
I believe this a cart page and it displays the right menu on mobile from what I can tell
– https://www.screencast.com/t/9ExYfqx9Lg
– https://www.screencast.com/t/63wkG8Zb
And for checkout as well
– https://www.screencast.com/t/BNLz99sA
– https://www.screencast.com/t/GFOfmjDRriBQ
Maybe I am misunderstanding this.
Thanks