Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dislokacia/1b1b171b4c0f3cfa021c948ba82bbee2 to your computer and use it in GitHub Desktop.
Save dislokacia/1b1b171b4c0f3cfa021c948ba82bbee2 to your computer and use it in GitHub Desktop.
Hide element, if there are no products in the cart (with Ajax events )
.empty_message {
display: none;
}
jQuery(document).ready(function( $ ){
$( document ).ajaxComplete(function() {
if (!Cookies.get('woocommerce_items_in_cart')) {
$('.empty_message').show();
} else {
$('.empty_message').hide();
}
});
if (!Cookies.get('woocommerce_items_in_cart')) {
$('.empty_message').show();
}
});
@dislokacia
Copy link
Author

Add the class 'empty_message' to the element you want to hide
https://gyazo.com/2c93eb1344ad8cda0ecdbea8ba7c5f71

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment