Cart doesn't display or link correctly in mobile menus
-
Here’s how my main menu looks on a mobile device, and here’s how the cart displays in the dropdown. There are 2 main problems here:
1) In the dropdown, it displays as ‘Menu’ rather than ‘Cart.’ Can I change that so users have some idea where to find the cart?
2) Clicking ‘2 items’ in the top bar, or ‘Menu’ in the dropdown, doesn’t take me to the cart page. It takes me to my usual home page with an extra /# stuck on the end, which eventually redirects to the main page.
2) This is a more minor issue, but without the shopping cart icon (which doesn’t show), I think seeing ‘0 items’ in the main menu bar would confuse customers when they first enter the site. I know I can hide it if it’s empty, but I’d rather not do that.
Everything works fine when I use my site on a computer. I added an extra image link in the footer so that mobile users can access the cart, but I’d rather just have Menu Cart functionality. Is there a way to make that work for mobile devices?
Thanks!
-
Hi There,
1) Appears to be a CSS issue. Your theme stylesheet has the following declaration:.sb-options li:last-child { display: none; }
Which hides the last menu item (supposedly for a reason, although I’m not sure what that reason is!). Normally you could force the item to show by addressing the ‘.wpmenucartli’ class, but in this case that won’t help because the mobile menu is a copy of the regular menu and without the classes. So the only option is to remove that CSS declaration.
2) That’s because that’s more like the title of menu. In you second screenshot, that’s “Dresses”. I think this is related to 1) (and 3!) in that this is supposed to be “Menu”.Can you try to add the following code to your themes functions.php?
add_filter( 'wpmenucart_prepend_menu_item', '__return_true' );
This will put the menu cart as the first item in the menu rather than the last (but won’t affect the desktop version because it will still align to the right!), and may solve all your problems.
Hope that helps!
Ewout
- The topic ‘Cart doesn't display or link correctly in mobile menus’ is closed to new replies.