WooCommerce Germanized - Version 1.9.3

Version Description

  • Fix: PHP Warning regarding WC_GZD_Shipping_Rate
  • Fix: Free shipping auto select WC 3.2
  • Improvement: Payment gateway field initialization
Download this release

Release Info

Developer vendidero
Plugin Icon 128x128 WooCommerce Germanized
Version 1.9.3
Comparing to
See all releases

Code changes from version 1.9.2 to 1.9.3

includes/class-wc-gzd-checkout.php CHANGED
@@ -81,8 +81,10 @@ class WC_GZD_Checkout {
81
  }
82
 
83
  // Free Shipping auto select
84
- if ( get_option( 'woocommerce_gzd_display_checkout_free_shipping_select' ) == 'yes' )
 
85
  add_filter( 'woocommerce_package_rates', array( $this, 'free_shipping_auto_select' ) );
 
86
 
87
  // Pay for order
88
  add_action( 'wp', array( $this, 'force_pay_order_redirect' ), 15 );
@@ -159,9 +161,15 @@ class WC_GZD_Checkout {
159
  return false;
160
  }
161
 
 
 
 
 
162
  public function free_shipping_auto_select( $rates ) {
163
 
164
- if ( ! is_checkout() && ! is_cart() )
 
 
165
  return $rates;
166
 
167
  $keep = array();
81
  }
82
 
83
  // Free Shipping auto select
84
+ if ( get_option( 'woocommerce_gzd_display_checkout_free_shipping_select' ) == 'yes' ) {
85
+ add_action( 'woocommerce_before_calculate_totals', array( $this, 'set_free_shipping_filter' ) );
86
  add_filter( 'woocommerce_package_rates', array( $this, 'free_shipping_auto_select' ) );
87
+ }
88
 
89
  // Pay for order
90
  add_action( 'wp', array( $this, 'force_pay_order_redirect' ), 15 );
161
  return false;
162
  }
163
 
164
+ public function set_free_shipping_filter( $cart ) {
165
+ $_POST[ 'update_cart' ] = true;
166
+ }
167
+
168
  public function free_shipping_auto_select( $rates ) {
169
 
170
+ $do_check = is_checkout() || is_cart() || ! empty( $_POST['update_cart'] );
171
+
172
+ if ( ! $do_check )
173
  return $rates;
174
 
175
  $keep = array();
includes/class-wc-gzd-payment-gateways.php CHANGED
@@ -21,7 +21,7 @@ class WC_GZD_Payment_Gateways {
21
  }
22
 
23
  public function __construct() {
24
- add_action( 'admin_init', array( $this, 'init_fields' ) );
25
  add_action( 'woocommerce_calculate_totals', array( $this, 'checkout' ) );
26
  add_action( 'woocommerce_cart_calculate_fees', array( $this, 'init_fee' ), 0 );
27
  }
21
  }
22
 
23
  public function __construct() {
24
+ add_action( 'woocommerce_settings_checkout', array( $this, 'init_fields' ), 0 );
25
  add_action( 'woocommerce_calculate_totals', array( $this, 'checkout' ) );
26
  add_action( 'woocommerce_cart_calculate_fees', array( $this, 'init_fee' ), 0 );
27
  }
includes/class-wc-gzd-shipping-rate.php CHANGED
@@ -5,15 +5,27 @@ class WC_GZD_Shipping_Rate extends WC_Shipping_Rate {
5
  public $tax_shares = array();
6
 
7
  public function __construct( WC_Shipping_Rate $rate ) {
8
- parent::__construct( $rate->id, $rate->label, $rate->cost, $rate->taxes, $rate->method_id );
9
-
 
 
 
 
 
 
 
 
 
 
 
 
10
  if ( get_option( 'woocommerce_gzd_shipping_tax' ) === 'yes' && ( ! empty( $rate->taxes ) || get_option( 'woocommerce_gzd_shipping_tax_force' ) === 'yes' ) )
11
- $this->set_taxes();
12
 
13
  $this->set_costs();
14
  }
15
 
16
- public function set_taxes() {
17
 
18
  $cart = WC()->cart;
19
  $this->tax_shares = wc_gzd_get_cart_tax_share();
@@ -39,7 +51,7 @@ class WC_GZD_Shipping_Rate extends WC_Shipping_Rate {
39
  $this->cost = $this->cost - array_sum( $this->taxes );
40
  }
41
 
42
- public function get_taxes() {
43
  return $this->taxes;
44
  }
45
 
5
  public $tax_shares = array();
6
 
7
  public function __construct( WC_Shipping_Rate $rate ) {
8
+
9
+ $num = 5;
10
+
11
+ try {
12
+ $method = new ReflectionMethod('WC_Shipping_Rate', '__construct' );
13
+ $num = $method->getNumberOfParameters();
14
+ } catch( Exception $e ) {}
15
+
16
+ if ( $num === 6 ) {
17
+ parent::__construct( $rate->id, $rate->label, $rate->cost, $rate->taxes, $rate->method_id, $rate->instance_id );
18
+ } else {
19
+ parent::__construct( $rate->id, $rate->label, $rate->cost, $rate->taxes, $rate->method_id );
20
+ }
21
+
22
  if ( get_option( 'woocommerce_gzd_shipping_tax' ) === 'yes' && ( ! empty( $rate->taxes ) || get_option( 'woocommerce_gzd_shipping_tax_force' ) === 'yes' ) )
23
+ $this->set_shared_taxes();
24
 
25
  $this->set_costs();
26
  }
27
 
28
+ public function set_shared_taxes() {
29
 
30
  $cart = WC()->cart;
31
  $this->tax_shares = wc_gzd_get_cart_tax_share();
51
  $this->cost = $this->cost - array_sum( $this->taxes );
52
  }
53
 
54
+ public function get_shared_taxes() {
55
  return $this->taxes;
56
  }
57
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Requires at least: 3.8
5
  Tested up to: 4.8
6
  WC requires at least: 2.4
7
  WC tested up to: 3.2
8
- Stable tag: 1.9.2
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -169,6 +169,11 @@ Bug reports may be filed via our [GitHub repository](https://github.com/vendider
169
 
170
  == Changelog ==
171
 
 
 
 
 
 
172
  = 1.9.2 =
173
  * Feature: Added Mulit-Currency-Support for Unit Prices (WPML)
174
  * Feature: Basic support for Subscriptions (Direct Debit Gateway)
5
  Tested up to: 4.8
6
  WC requires at least: 2.4
7
  WC tested up to: 3.2
8
+ Stable tag: 1.9.3
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
169
 
170
  == Changelog ==
171
 
172
+ = 1.9.3 =
173
+ * Fix: PHP Warning regarding WC_GZD_Shipping_Rate
174
+ * Fix: Free shipping auto select WC 3.2
175
+ * Improvement: Payment gateway field initialization
176
+
177
  = 1.9.2 =
178
  * Feature: Added Mulit-Currency-Support for Unit Prices (WPML)
179
  * Feature: Basic support for Subscriptions (Direct Debit Gateway)
woocommerce-germanized.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WooCommerce Germanized
4
  * Plugin URI: https://www.vendidero.de/woocommerce-germanized
5
  * Description: Extends WooCommerce to become a legally compliant store for the german market.
6
- * Version: 1.9.2
7
  * Author: Vendidero
8
  * Author URI: https://vendidero.de
9
  * Requires at least: 3.8
@@ -31,7 +31,7 @@ final class WooCommerce_Germanized {
31
  *
32
  * @var string
33
  */
34
- public $version = '1.9.2';
35
 
36
  /**
37
  * Single instance of WooCommerce Germanized Main Class
3
  * Plugin Name: WooCommerce Germanized
4
  * Plugin URI: https://www.vendidero.de/woocommerce-germanized
5
  * Description: Extends WooCommerce to become a legally compliant store for the german market.
6
+ * Version: 1.9.3
7
  * Author: Vendidero
8
  * Author URI: https://vendidero.de
9
  * Requires at least: 3.8
31
  *
32
  * @var string
33
  */
34
+ public $version = '1.9.3';
35
 
36
  /**
37
  * Single instance of WooCommerce Germanized Main Class