- This topic has 1 reply, 2 voices, and was last updated 15 years ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
Support site for Tips and Tricks HQ premium products
by
Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › WP eStore Tweaks › how to hide shopping cart widget altogether when empty?
Tagged: Cart Widget Tweak, hide widget
i only want the widget to appear on the side when a product is added, and to disappear if all products are unselected. how do i do this?
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;
}