Hi there,
By default, that Storefront footer menu also provides access to the My Account page and search (not just to access the Cart contents). However, it should be possible to hide it when the Cart is empty.
First, you could add a class to the HTML body element to indicate whether the Cart is empty or not:
add_filter('body_class','add_cart_status_class_to_body');
function add_cart_status_class_to_body($classes) {
global $woocommerce;
if ( $woocommerce->cart->cart_contents_count > 0 ) {
$classes[] = 'cart-not-empty';
} else {
$classes[] = 'cart-empty';
}
return $classes;
}
That code should be added to your child theme’s functions.php
file or via a plugin that allows custom functions to be added, such as the Code Snippets plugin. Please don’t add custom code directly to your parent theme’s functions.php
file as this will be wiped entirely when you update.
After that, you can hide the Storefront mobile footer bar based on that status:
body.cart-empty .storefront-handheld-footer-bar {
display:none;
}
You can add that to the “Additional CSS” section of your Customizer (Appearance > Customize).
I hope that helps!