As a result, I definitely don’t need the whole “Mini-Cart Widget Dropdown Content”. To test, try to “hover” onto the shopping cart icon on the top right, and you’ll notice there is no cart dropdown.
Well, this is how it’s done – I love when a complex thing is fixed with one simple line of PHP!
WooCommerce: Hide the Mini-Cart Widget Dropdown Content
PHP Snippet: Hide Menu Mini-Cart Widget Dropdown @ WooCommerce Header
WooCommerce: Only Allow to Buy a Product Once In the era of online courses, subscriptions, custom-made products and product personalization, it may happen a scenario where a user...
Please let me know in the comments if everything went as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting.
If you think this code saved you time & money, feel free to join 17,000+ WooCommerce Weekly subscribers for blog post updates and 250+ Business Bloomer supporters for 365 days of WooCommerce benefits. Thank you in advance!
Need Help with WooCommerce?
Check out these free video tutorials. You can learn how to customize WooCommerce without unnecessary plugins, how to properly configure the WooCommerce plugin settings and even how to master WooCommerce troubleshooting in case of a bug!
Rodolfo Melogli
Business Bloomer Founder
Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza.
Hi Ronald, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Used your code on my website, but my whole WC Cart was hidden. I want to leave Menu Cart Icon and if someone will click on it, it will take him to the Cart Page. So I want to hide just WC Menu Cart Dropdown (Mini Cart). Can you help me with that?
Hi Danylo, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Hi, I have a problem. I’m editing a store through Elementor Pro, and when clicking on the “menu cart” widget, I would like it to open the checkout page directly, instead of opening a preview sidebar, could you help me?
It works a treat for hiding the mini-cart widget. I think it’s possibly creating a browser error, though,
Uncaught TypeError: Cannot read property ‘getBoundingClientRect’ of null
at HTMLUListElement. (header-cart.min.js:1)
I tested for browser errors with and without the snippet and it seems to be related as the mini-cart is made null.
Hello Stephane, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Hello Rob, thanks for your comment! Avada has its own custom WooCommerce templates, so probably this function will need to be edited for that reason. Hope this helps 🙂
Hey Hans, thanks for your comment! This is for all themes as it’s a default WooCommerce functionality. Some non-WooCommerce themes don’t show the Cart Widget in the navigation bar though, so it depends, yes 🙂 It works on Storefront for sure.
Alright, thanks. I use genesis framework, so those themes don’t show the the cart widget in the navigation, although some basic woocommerce support is build-in. Do you have a snippet to add, or is the use of a plugin advised?
Questions? Feedback? Support? Leave your Comment Now! _____
If you are writing code, please wrap it between shortcodes: [php]code_here[/php]. Failure to complying with this (as well as going off topic, not writing in English, etc.) will result in comment deletion. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining BloomerArmada to get blog comment reply priority, ask me 1-to-1 WooCommerce questions and enjoy many more perks. Thank you :)
With 100,000 (and growing) monthly organic sessions, Business Bloomer is the most consistent, most active and most complete WooCommerce development/customization blog.
Of course this website itself uses the WooCommerce plugin, the Storefront theme and runs on a WooCommerce-friendly hosting.
Nice post, but i would like to know the opposite, thats how to show the dropdown containint the mini cart on mouse click
Hi Ronald, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Hi,
Used your code on my website, but my whole WC Cart was hidden. I want to leave Menu Cart Icon and if someone will click on it, it will take him to the Cart Page. So I want to hide just WC Menu Cart Dropdown (Mini Cart). Can you help me with that?
Regards,
Danylo
Hi Danylo, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Hi, I have a problem. I’m editing a store through Elementor Pro, and when clicking on the “menu cart” widget, I would like it to open the checkout page directly, instead of opening a preview sidebar, could you help me?
Ask Elementor support please
Thanks for this snippet Rodofo!
It works a treat for hiding the mini-cart widget. I think it’s possibly creating a browser error, though,
Uncaught TypeError: Cannot read property ‘getBoundingClientRect’ of null
at HTMLUListElement. (header-cart.min.js:1)
I tested for browser errors with and without the snippet and it seems to be related as the mini-cart is made null.
I appreciate all you’re doing to help others!
Hi Tiffany! I guess that JS script also needs to be dequeued – this should fix your problem 🙂
Hi Rodolfo!
Thank you for this amazing post! 😉
May I ask you a question? How to edit a button in the mini cart widget (ie checkout > Secure checkout) ?
Thank you Rodolfo.
Hello Stephane, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Unable to get this to hide the drop-down in my Avada theme installation. I’m running a child theme.
Hello Rob, thanks for your comment! Avada has its own custom WooCommerce templates, so probably this function will need to be edited for that reason. Hope this helps 🙂
Hi Rodolfo,
Thanks for the snippet. Is this snippet for use in a specific theme? It looks like storefront, but you haven’t specified.
Thanks,
Hans
Hey Hans, thanks for your comment! This is for all themes as it’s a default WooCommerce functionality. Some non-WooCommerce themes don’t show the Cart Widget in the navigation bar though, so it depends, yes 🙂 It works on Storefront for sure.
Alright, thanks. I use genesis framework, so those themes don’t show the the cart widget in the navigation, although some basic woocommerce support is build-in. Do you have a snippet to add, or is the use of a plugin advised?
Hans
Hey Hans! You can add the cart widget by using this PHP function: