How can I show the cart in the menu outside the shop area?

If you have a shop on your website, you may want to display a cart button on the top side menu. You already can do this by simply going to Appearance → Customize → WooCommerce → Options area and check the Show cart menu in main navigation option. However, this will only display the cart when you’re in the shop area (shop archive or single product).

If you want to display this cart on the top side all over your website (when checking a website or maybe the contact page), you just need to use the following code:

function pile_show_mini_cart() {
	return class_exists( 'WooCommerce' ) &&  && pile_option( 'show_cart_menu' );

You can add this code to the child theme. This way, you can make sure that the changes won’t disappear when a new update of the theme will be available.

Updated on August 25, 2020

Can't find what you’re looking for? Ask a human.

We're a small team of real people providing real help. Send us an email at and we will give you a helping hand.