Skip to content

Commit

Permalink
Cart tab 1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jameskoster committed Jul 5, 2018
1 parent ea5465a commit 875a4f6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
9 changes: 9 additions & 0 deletions assets/js/cart-tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@
});

setCartHeight();

/**
* Hide cart tab when cart is empty
*/
jQuery( 'body' ).on( 'removed_from_cart', function() {
if ( Cookies.get( 'woocommerce_items_in_cart' ) == null ) {
hideCart();
}
});
});

/**
Expand Down
2 changes: 1 addition & 1 deletion assets/js/cart-tab.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions cart-tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
/**
* Plugin Name: WooCommerce Cart Tab
* Plugin URI: http://jameskoster.co.uk/tag/cart-tab/
* Version: 1.1.1
* Version: 1.1.2
* Description: Displays a sitewide link to the cart which reveals the cart contents on hover.
* Author: jameskoster
* Tested up to: 4.7.3
* Tested up to: 4.9.6
* Author URI: http://jameskoster.co.uk
* Text Domain: woocommerce-cart-tab
* Domain Path: /languages/
Expand Down Expand Up @@ -56,7 +56,7 @@ class WooCommerce_Cart_Tab {
*/
public function __construct() {
$this->token = 'woocommerce-cart-tab';
$this->version = '1.1.1';
$this->version = '1.1.2';
$this->setup();
register_activation_hook( __FILE__, array( $this, 'install' ) );
}
Expand Down
2 changes: 1 addition & 1 deletion includes/class-cart-tab-frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class WooCommerce_Cart_Tab_Frontend {
*/
public function __construct() {
add_action( 'wp_enqueue_scripts', array( $this, 'setup_styles' ), 999 );

if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
add_filter( 'add_to_cart_fragments', array( $this, 'woocommerce_cart_tab_add_to_cart_fragment' ) );
} else {
Expand Down
9 changes: 6 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Contributors: jameskoster
Tags: woocommerce, ecommerce, cart
Requires at least: 4.4
Tested up to: 4.7.3
Stable tag: 1.1.1
Tested up to: 4.9.6
Stable tag: 1.1.2
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -44,6 +44,9 @@ Thanks! Please fork the repo on <a href="https://github.com/jameskoster/woocomme

== Changelog ==

= 1.1.2 - 05/07/2018 =
* Fix - Cart panel will now close automatically when the cart is emptied.

= 1.1.1 - 10/03/2017 =
* Tweak - WooCommerce 2.7 support. Kudos @webmandesign.
* Dev - Scripts and styles now versioned correctly.
Expand Down Expand Up @@ -92,4 +95,4 @@ Thanks! Please fork the repo on <a href="https://github.com/jameskoster/woocomme
* Stripped object pass by reference

= 0.1 =
Initial release.
Initial release.

0 comments on commit 875a4f6

Please sign in to comment.