Skip to content

Commit

Permalink
Merge pull request #40 from webmandesign/patch-1
Browse files Browse the repository at this point in the history
Adding WooCommerce 2.7 compatibility
  • Loading branch information
jameskoster authored Mar 10, 2017
2 parents 8efecc2 + 8e3382e commit 0736466
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions includes/class-cart-tab-frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,15 @@ class WooCommerce_Cart_Tab_Frontend {
* @since 1.0.0
*/
public function __construct() {
add_action( 'wp_enqueue_scripts', array( $this, 'setup_styles' ), 999 );
add_filter( 'add_to_cart_fragments', array( $this, 'woocommerce_cart_tab_add_to_cart_fragment' ) );
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 {
add_filter( 'woocommerce_add_to_cart_fragments', array( $this, 'woocommerce_cart_tab_add_to_cart_fragment' ) );
}

add_action( 'wp_footer', 'woocommerce_cart_tab' );
add_action( 'wp_footer', 'woocommerce_cart_tab' );
}

/**
Expand Down Expand Up @@ -63,4 +68,7 @@ function woocommerce_cart_tab_add_to_cart_fragment( $fragments ) {

endif;

return new WooCommerce_Cart_Tab_Frontend();
function woocommerce_cart_tab_frontend() {
return new WooCommerce_Cart_Tab_Frontend();
}
add_action( 'init', 'woocommerce_cart_tab_frontend' );

0 comments on commit 0736466

Please sign in to comment.