Skip to content

Instantly share code, notes, and snippets.

@shubhw12
Created February 12, 2021 04:54
Show Gist options
  • Save shubhw12/7f75be0e68a87ff81d05a7f05d10747b to your computer and use it in GitHub Desktop.
Save shubhw12/7f75be0e68a87ff81d05a7f05d10747b to your computer and use it in GitHub Desktop.
Remove cart icon if empty in new header footer builder.
add_action( 'wp', 'remove_empty_cart_icon_from_header' );
function remove_empty_cart_icon_from_header( $show ) {
if ( null != WC()->cart && 0 == WC()->cart->get_cart_contents_count() ) {
remove_action( 'astra_header_woo_cart', array( Astra_Builder_Header::get_instance(), 'header_woo_cart' ) );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment