Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › WP eStore Tweaks › how to hide shopping cart widget altogether when empty? › Reply To: how to hide shopping cart widget altogether when empty?
November 12, 2009 at 2:09 am
#15947
Participant
Update: The post has an easier method of only showing the cart when there are items in it:
https://support.tipsandtricks-hq.com/forums/topic/estore-want-to-hide-empty-cart-widget
Find the following bit of code in “wp_eStore1.php” file (this is what displays the widget):
function show_wp_digi_cart_widget($args)
{
extract($args);
$cart_title = get_option('wp_eStore_widget_title');
if (empty($cart_title)) $cart_title = 'Shopping Cart';
echo $before_widget;
echo $before_title . $cart_title . $after_title;
echo print_wp_digi_cart();
echo $after_widget;
}
Now add the following at the start of the function (before the line with the “extract” statement) so it doesn’t display the widget if there are no items in the shopping cart:
if (!digi_cart_not_empty())
{
return;
}