- This topic has 13 replies, 4 voices, and was last updated 2 years, 11 months ago by
Leo.
-
AuthorPosts
-
March 27, 2023 at 3:05 pm #2584806
Gilles
Hi,
On the woocommerce product pages, I would like to display only the logo and the shopping cart (like this : https://i.imgur.com/cGquTBm.jpeg), without the tabs normally on the main menu – https://i.imgur.com/JqqCa9A.jpeg).
I deactivated the menu on these pages… but obviously the basket does not appear.
Is there a way to do this ?
I specify that the secondary menu is already used (for the member area).
ThanksMarch 27, 2023 at 3:27 pm #2584810Leo
StaffCustomer SupportHi there,
In theory, I believe you can a plugin like If Menu:
https://wordpress.org/plugins/if-menu/Then create a new menu with no items in it then assign it to the single product pages – I’m not sure if the plugin offers this specific condition though.
If the above solution fails then we could use CSS as an alternative solution:
.single-product .main-navigation .main-nav { display: none; }Learn how to add CSS: https://docs.generatepress.com/article/adding-css/
Let me know if this helps 🙂
March 27, 2023 at 11:04 pm #2585015Gilles
Hi,
The css code works. Thanks !
I would also like to hide the basket if it’s empty (this time not only on the product pages but on the whole site)… A solution?March 27, 2023 at 11:36 pm #2585035Fernando Customer Support
Hi Gilles,
Can you try adding this through Appearance > Customize > Additional CSS?:
.menu-bar-items .wc-menu-item:not(.has-items) { display: none; }March 27, 2023 at 11:49 pm #2585047Gilles
Hi Fernando,
THANKS. it works.
However, I just saw that the CSS code to hide the menu items on the product pages did not work on mobile… I imagine it is possible to add something to the code to make it work?March 28, 2023 at 12:16 am #2585076Fernando Customer Support
Try adding this as well:
.single-product nav#mobile-header button.menu-toggle{ display: none; }March 28, 2023 at 1:59 am #2585202Gilles
Ok, it works correctly… but when testing I find that it’s random (both on desktop and mobile)… In general, the basket is displayed well after adding a product… but sometimes when I then go to another page (in particular the home page), or when returning to the same page, it is not displayed… Or, after having emptied the basket, if I return to the product previously added, the empty basket is displayed.. .Probably a cache problem (I use Lite Speed Cache)… Is it possible to exclude the shopping cart from the cache? Here is the link of my website: https://www.un-jardin-bio.com/
March 28, 2023 at 4:54 am #2585404David
StaffCustomer SupportHi there,
does this help:
https://blog.litespeedtech.com/2017/05/31/wpw-fixing-lscachewoocommerce-conflicts/
March 28, 2023 at 5:27 am #2585450Gilles
Hi David,
it seems to work perfectly now.
Thank you so much !March 28, 2023 at 6:04 am #2585509David
StaffCustomer SupportGlad we could be of help!!
Oh… and thank you for the 5 star review 🙂
March 29, 2023 at 11:38 pm #2588198Gilles
Hi,
I’m reviving this ticket because there is still a small problem.
By excluding this cookie from the caches, when a product is added to the basket, all the pages subsequently visited are no longer cached (the loading of the pages is therefore slower).
I opened a ticket on Lite Speed support and was told that this is normal behavior when excluding a cache… and that it is a compatibility issue with my theme (I specify that this problem of random display of the basket appears without the modifications of the css code added to not display the menu tabs on the Products pages).
Can this problem be solved on the theme side, without having to exclude the cookie?March 30, 2023 at 6:29 am #2588718David
StaffCustomer SupportAll the theme does is make the function callback to display the Woocommerce mini cart ( which is a woo function ). We don’t control what it does or how caches interact with it.
What is the issue that Litespeed thinks is theme related ?March 30, 2023 at 10:48 am #2589298Gilles
Here is the response received…
As described in the blog post on the LiteSpeed Blog, there is no real solution to this problem. LiteSpeed is basically compatible with WooCommerce, but there are themes where compatibility cannot be fully guaranteed. Apparently you have such a theme, which is why the solution can only be that the cache is deactivated as soon as a customer puts an item in the shopping cart. If this is the case, WooCommerce creates cookie “woocommerce_items_in_cart”. This cookie name must then be entered as an exclusion criterion in the cache plugin settings. This ultimately means that once a customer has added an item to their cart, the cache is disabled for all pages.March 30, 2023 at 10:58 am #2589312Leo
StaffCustomer SupportI would go with the solution LiteSpeed suggested.
As David mentioned above, this isn’t something GP can control – GP simply uses the functionality from WooCommerce core.
If you need further help with this, please open a new topic as the original topic is resolved.
Thank you!
-
AuthorPosts
- The topic ‘Menu with only cart on product page’ is closed to new replies.