WooCommerce Menu Cart - Version 2.9.0

Version Description

  • New: setting to include fees & shipping in cart total [WooCommerce]
  • New: hide on checkout & cart page by default (can be re-enabled via the settings) [WooCommerce]
  • Fix: Incorrect total for when using "Cart total (including discounts)" in combination with taxable fees
  • Fix: Button to save settings invisible on some installations
Download this release

Release Info

Developer wpovernight
Plugin Icon 128x128 WooCommerce Menu Cart
Version 2.9.0
Comparing to
See all releases

Code changes from version 2.8.2 to 2.9.0

includes/wpmenucart-settings.php CHANGED
@@ -83,6 +83,21 @@ class WpMenuCart_Settings {
83
  )
84
  );
85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  add_settings_field(
87
  'icon_display',
88
  __( 'Display shopping cart icon.', 'wp-menu-cart' ),
@@ -208,8 +223,9 @@ class WpMenuCart_Settings {
208
  'menu' => $option,
209
  'id' => 'total_price_type',
210
  'options' => array(
211
- 'total' => __( 'Cart total (including discounts)' , 'wp-menu-cart' ),
212
- 'subtotal' => __( 'Subtotal (total of products)' , 'wp-menu-cart' ),
 
213
  ),
214
  'default' => 'total',
215
  )
@@ -394,6 +410,7 @@ class WpMenuCart_Settings {
394
  min-height: 90px;
395
  position: relative;
396
  padding-left: 120px;
 
397
  }
398
  .menucart-pro-ad-small {
399
  position: absolute;
83
  )
84
  );
85
 
86
+ if (function_exists('WC')) {
87
+ add_settings_field(
88
+ 'show_on_cart_checkout_page',
89
+ __( 'Show on cart & checkout page', 'wp-menu-cart' ),
90
+ array( &$this, 'checkbox_element_callback' ),
91
+ $option,
92
+ 'plugin_settings',
93
+ array(
94
+ 'menu' => $option,
95
+ 'id' => 'show_on_cart_checkout_page',
96
+ 'description' => __( 'To avoid distracting your customers with duplicate information we do not display the menu cart item on the cart & checkout pages by default', 'wp-menu-cart' ),
97
+ )
98
+ );
99
+ }
100
+
101
  add_settings_field(
102
  'icon_display',
103
  __( 'Display shopping cart icon.', 'wp-menu-cart' ),
223
  'menu' => $option,
224
  'id' => 'total_price_type',
225
  'options' => array(
226
+ 'total' => __( 'Cart total (including discounts)' , 'wp-menu-cart' ),
227
+ 'subtotal' => __( 'Subtotal (total of products)' , 'wp-menu-cart' ),
228
+ 'checkout_total' => __( 'Checkout total (including discounts, fees & shipping)' , 'wp-menu-cart' ),
229
  ),
230
  'default' => 'total',
231
  )
410
  min-height: 90px;
411
  position: relative;
412
  padding-left: 120px;
413
+ clear: both;
414
  }
415
  .menucart-pro-ad-small {
416
  position: absolute;
includes/wpmenucart-woocommerce.php CHANGED
@@ -30,7 +30,7 @@ if ( ! class_exists( 'WPMenuCart_WooCommerce' ) ) {
30
  global $woocommerce;
31
  if ( empty( $woocommerce->cart ) ) {
32
  $woocommerce->cart = new WC_Cart();
33
- }
34
  }
35
  }
36
 
@@ -65,16 +65,18 @@ if ( ! class_exists( 'WPMenuCart_WooCommerce' ) ) {
65
 
66
  public function get_cart_total() {
67
  $settings = get_option('wpmenucart');
68
- if ( defined('WC_VERSION') && version_compare( WC_VERSION, '3.2', '>=' ) ) {
69
  if (isset($settings['total_price_type']) && $settings['total_price_type'] == 'subtotal') {
70
  if ( WC()->cart->display_prices_including_tax() ) {
71
  $cart_contents_total = wc_price( WC()->cart->get_subtotal() + WC()->cart->get_subtotal_tax() );
72
  } else {
73
  $cart_contents_total = wc_price( WC()->cart->get_subtotal() );
74
  }
 
 
75
  } else {
76
  if ( WC()->cart->display_prices_including_tax() ) {
77
- $cart_contents_total = wc_price( WC()->cart->get_cart_contents_total() + WC()->cart->get_fee_tax() + WC()->cart->get_cart_contents_tax() );
78
  } else {
79
  $cart_contents_total = wc_price( WC()->cart->get_cart_contents_total() );
80
  }
30
  global $woocommerce;
31
  if ( empty( $woocommerce->cart ) ) {
32
  $woocommerce->cart = new WC_Cart();
33
+ }
34
  }
35
  }
36
 
65
 
66
  public function get_cart_total() {
67
  $settings = get_option('wpmenucart');
68
+ if ( defined('WC_VERSION') && version_compare( WC_VERSION, '3.2', '>=' ) ) {
69
  if (isset($settings['total_price_type']) && $settings['total_price_type'] == 'subtotal') {
70
  if ( WC()->cart->display_prices_including_tax() ) {
71
  $cart_contents_total = wc_price( WC()->cart->get_subtotal() + WC()->cart->get_subtotal_tax() );
72
  } else {
73
  $cart_contents_total = wc_price( WC()->cart->get_subtotal() );
74
  }
75
+ } elseif (isset($settings['total_price_type']) && $settings['total_price_type'] == 'checkout_total') {
76
+ $cart_contents_total = wc_price( WC()->cart->get_total('edit') );
77
  } else {
78
  if ( WC()->cart->display_prices_including_tax() ) {
79
+ $cart_contents_total = wc_price( WC()->cart->get_cart_contents_total() + WC()->cart->get_cart_contents_tax() );
80
  } else {
81
  $cart_contents_total = wc_price( WC()->cart->get_cart_contents_total() );
82
  }
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: woocommerce, menu, bar, cart, basket, header, shopping cart, navigation, e
5
  Requires at least: 3.4
6
  Tested up to: 5.4
7
  Requires PHP: 5.3
8
- Stable tag: 2.8.2
9
 
10
  Automatically displays a shopping cart in your menu bar. Works with WooCommerce, WP-Ecommerce, EDD, Eshop and Jigoshop
11
 
@@ -85,6 +85,12 @@ Once the plugin is activated navigate to Settings > Menu Cart Setup. Select your
85
 
86
  == Changelog ==
87
 
 
 
 
 
 
 
88
  = 2.8.2 =
89
  * Tested up to WooCommerce 4.2
90
 
5
  Requires at least: 3.4
6
  Tested up to: 5.4
7
  Requires PHP: 5.3
8
+ Stable tag: 2.9.0
9
 
10
  Automatically displays a shopping cart in your menu bar. Works with WooCommerce, WP-Ecommerce, EDD, Eshop and Jigoshop
11
 
85
 
86
  == Changelog ==
87
 
88
+ = 2.9.0 =
89
+ * New: setting to include fees & shipping in cart total [WooCommerce]
90
+ * New: hide on checkout & cart page by default (can be re-enabled via the settings) [WooCommerce]
91
+ * Fix: Incorrect total for when using "Cart total (including discounts)" in combination with taxable fees
92
+ * Fix: Button to save settings invisible on some installations
93
+
94
  = 2.8.2 =
95
  * Tested up to WooCommerce 4.2
96
 
wp-menu-cart.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WooCommerce Menu Cart
4
  * Plugin URI: www.wpovernight.com/plugins
5
  * Description: Extension for your e-commerce plugin (WooCommerce, WP-Ecommerce, Easy Digital Downloads, Eshop or Jigoshop) that places a cart icon with number of items and total cost in the menu bar. Activate the plugin, set your options and you're ready to go! Will automatically conform to your theme styles.
6
- * Version: 2.8.2
7
  * Author: Jeremiah Prummer, Ewout Fernhout
8
  * Author URI: www.wpovernight.com/
9
  * License: GPL2
@@ -14,7 +14,7 @@
14
 
15
  class WpMenuCart {
16
 
17
- protected $plugin_version = '2.8.2';
18
  public static $plugin_slug;
19
  public static $plugin_basename;
20
 
@@ -452,6 +452,9 @@ class WpMenuCart {
452
  // WooCommerce specific: check if woocommerce cart object is actually loaded
453
  if ( isset($this->options['shop_plugin']) && $this->options['shop_plugin'] == 'woocommerce' ) {
454
  if ( function_exists( 'WC' ) ) {
 
 
 
455
  if ( empty( WC()->cart ) ) {
456
  return $items; // nothing to load data from, return menu without cart item
457
  }
3
  * Plugin Name: WooCommerce Menu Cart
4
  * Plugin URI: www.wpovernight.com/plugins
5
  * Description: Extension for your e-commerce plugin (WooCommerce, WP-Ecommerce, Easy Digital Downloads, Eshop or Jigoshop) that places a cart icon with number of items and total cost in the menu bar. Activate the plugin, set your options and you're ready to go! Will automatically conform to your theme styles.
6
+ * Version: 2.9.0
7
  * Author: Jeremiah Prummer, Ewout Fernhout
8
  * Author URI: www.wpovernight.com/
9
  * License: GPL2
14
 
15
  class WpMenuCart {
16
 
17
+ protected $plugin_version = '2.9.0';
18
  public static $plugin_slug;
19
  public static $plugin_basename;
20
 
452
  // WooCommerce specific: check if woocommerce cart object is actually loaded
453
  if ( isset($this->options['shop_plugin']) && $this->options['shop_plugin'] == 'woocommerce' ) {
454
  if ( function_exists( 'WC' ) ) {
455
+ if ( ( is_checkout() || is_cart() ) && empty($this->options['show_on_cart_checkout_page']) ) {
456
+ return $items;
457
+ }
458
  if ( empty( WC()->cart ) ) {
459
  return $items; // nothing to load data from, return menu without cart item
460
  }