Home>Support>Hiding Mini Cart when empty

Hiding Mini Cart when empty

Hi There,

I’m using Corp Theme – wondering if there is any way to hide the header/menu mini-cart when its empty?

So I’d like it to only display once / if someone adds something to their cart?

Preferably a way to do it with CSS, but can fiddle with PHP iof thats the only solution.

Been struggling with this for a while, so look forward to your feedback,

With thanks,

Niki

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 3 years, 5 months ago Andrew Misplon
    Hi, I Work Here

    Hi Niki

    Thanks for reaching out.

    We’ll add a filter to make this possible in the next Corp release. You can find a beta release here. Once the update has been installed you can apply the filter using Code Snippets plugin or a child theme.

    add_filter( 'siteorigin_corp_display_mini_cart', function( $status ) {
    	return ! is_cart() && ! is_checkout() && ! WC()->cart->is_empty();
    } );
  2. 3 years, 5 months ago Niki Gower

    Hi Andrew,

    Thank-you – great to here you’re incorporating this into the Corp theme, its a great option to only have it appear when needed.

    Just to confirm – I update to the Beta (or official release, when out ) and then add this to a child theme’s functions.php file?

    I’m not currently working with a child theme, but all my changes have been in SO’s ‘Additional CSS’ in Customizer, so I should be pretty set to update and then create a child theme after – and retain all my CSS tweaks?

    Thanks-so much for taking the time to respond, really appreciate it!.

    Niki

  3. 3 years, 5 months ago Andrew Misplon
    Hi, I Work Here

    Sure, glad we could help :)

    You’ll install the ZIP file from my link above from AppearanceThemesAdd NewUpload Theme. When the next release of Corp is out you can update normally. The function should be inserted into your child theme functions.php file or you can use Code Snippets. If you need a child theme for Corp, you can find one here. If you aren’t currently using a child theme then it’s easier to make this change using https://wordpress.org/plugins/code-snippets/.

  4. 3 years, 5 months ago Niki Gower

    Much appreciated, have a great day/evening.

    P.S. SiteOrigin is awesome.

    :)

  5. 3 years, 5 months ago Andrew Misplon
    Hi, I Work Here

    Thanks, you too :) Thanks for your support.

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More