Flexible Shipping for WooCommerce - Version 4.0.6

Version Description

  • 2020-12-28 =
  • Fixed calculation for rules with multiple conditions
Download this release

Release Info

Developer wpdesk
Plugin Icon 128x128 Flexible Shipping for WooCommerce
Version 4.0.6
Comparing to
See all releases

Code changes from version 4.0.5 to 4.0.6

classes/table-rate/shipping-method.php CHANGED
@@ -622,7 +622,6 @@ class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
622
  $logger
623
  );
624
 
625
- $cost_calculator->process_shipping_rules_on_shipping_contents();
626
  $cost_calculator->process_rules();
627
 
628
  $add_method = false;
622
  $logger
623
  );
624
 
 
625
  $cost_calculator->process_rules();
626
 
627
  $add_method = false;
composer.lock CHANGED
@@ -2330,16 +2330,16 @@
2330
  },
2331
  {
2332
  "name": "matthiasmullie/minify",
2333
- "version": "1.3.63",
2334
  "source": {
2335
  "type": "git",
2336
  "url": "https://github.com/matthiasmullie/minify.git",
2337
- "reference": "9ba1b459828adc13430f4dd6c49dae4950dc4117"
2338
  },
2339
  "dist": {
2340
  "type": "zip",
2341
- "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/9ba1b459828adc13430f4dd6c49dae4950dc4117",
2342
- "reference": "9ba1b459828adc13430f4dd6c49dae4950dc4117",
2343
  "shasum": ""
2344
  },
2345
  "require": {
@@ -2386,7 +2386,7 @@
2386
  "minifier",
2387
  "minify"
2388
  ],
2389
- "time": "2020-01-21T20:21:08+00:00"
2390
  },
2391
  {
2392
  "name": "matthiasmullie/path-converter",
2330
  },
2331
  {
2332
  "name": "matthiasmullie/minify",
2333
+ "version": "1.3.64",
2334
  "source": {
2335
  "type": "git",
2336
  "url": "https://github.com/matthiasmullie/minify.git",
2337
+ "reference": "38f9d58c739687e269f46c6dff4647de9e2eb855"
2338
  },
2339
  "dist": {
2340
  "type": "zip",
2341
+ "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/38f9d58c739687e269f46c6dff4647de9e2eb855",
2342
+ "reference": "38f9d58c739687e269f46c6dff4647de9e2eb855",
2343
  "shasum": ""
2344
  },
2345
  "require": {
2386
  "minifier",
2387
  "minify"
2388
  ],
2389
+ "time": "2020-12-23T13:37:53+00:00"
2390
  },
2391
  {
2392
  "name": "matthiasmullie/path-converter",
flexible-shipping.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Flexible Shipping
4
  * Plugin URI: https://wordpress.org/plugins/flexible-shipping/
5
  * Description: Create additional shipment methods in WooCommerce and enable pricing based on cart weight or total.
6
- * Version: 4.0.5
7
  * Author: WP Desk
8
  * Author URI: https://flexibleshipping.com/?utm_source=plugin-list&utm_medium=link&utm_campaign=flexible-shipping-plugin-list
9
  * Text Domain: flexible-shipping
@@ -38,7 +38,7 @@ if ( ! defined( 'ABSPATH' ) ) {
38
  } // Exit if accessed directly
39
 
40
  /* THIS VARIABLE CAN BE CHANGED AUTOMATICALLY */
41
- $plugin_version = '4.0.5';
42
 
43
  $plugin_name = 'Flexible Shipping';
44
  $product_id = 'Flexible Shipping';
3
  * Plugin Name: Flexible Shipping
4
  * Plugin URI: https://wordpress.org/plugins/flexible-shipping/
5
  * Description: Create additional shipment methods in WooCommerce and enable pricing based on cart weight or total.
6
+ * Version: 4.0.6
7
  * Author: WP Desk
8
  * Author URI: https://flexibleshipping.com/?utm_source=plugin-list&utm_medium=link&utm_campaign=flexible-shipping-plugin-list
9
  * Text Domain: flexible-shipping
38
  } // Exit if accessed directly
39
 
40
  /* THIS VARIABLE CAN BE CHANGED AUTOMATICALLY */
41
+ $plugin_version = '4.0.6';
42
 
43
  $plugin_name = 'Flexible Shipping';
44
  $product_id = 'Flexible Shipping';
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://flexibleshipping.com/table-rate/
4
  Tags: table rate, table rate shipping, conditional shipping, shipping method, woocommerce shipping, flexible shipping, woocommerce table rate shipping, cart based shipping, weight shipping, weight based shipping, totals based shipping, order based shipping, shipping zones, shipping classes, shipping, free shipping, advanced shipping
5
  Requires at least: 4.5
6
  Tested up to: 5.6
7
- Stable tag: 4.0.5
8
  Requires PHP: 7.0
9
  License: GPLv3 or later
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -163,8 +163,11 @@ If you are upgrading from the old Flexible Shipping version (1.3.2, woo-flexible
163
 
164
  == Changelog ==
165
 
 
 
 
166
  = 4.0.5 - 2020-12-23 =
167
- * Fixed "Invalid argument supplied for foreach() shipping-method.php
168
 
169
  = 4.0.4 - 2020-12-22 =
170
  * Fixed free shipping notice functionality
@@ -653,4 +656,4 @@ Fixed error 500 after update to 2.1.8 version
653
  * Added WooCommerce 2.3 compatibility
654
 
655
  = 1.0 - 2015-11-03 =
656
- * First release!
4
  Tags: table rate, table rate shipping, conditional shipping, shipping method, woocommerce shipping, flexible shipping, woocommerce table rate shipping, cart based shipping, weight shipping, weight based shipping, totals based shipping, order based shipping, shipping zones, shipping classes, shipping, free shipping, advanced shipping
5
  Requires at least: 4.5
6
  Tested up to: 5.6
7
+ Stable tag: 4.0.6
8
  Requires PHP: 7.0
9
  License: GPLv3 or later
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
163
 
164
  == Changelog ==
165
 
166
+ = 4.0.6 - 2020-12-28 =
167
+ * Fixed calculation for rules with multiple conditions
168
+
169
  = 4.0.5 - 2020-12-23 =
170
+ * Fixed Invalid argument supplied for foreach() shipping-method.php
171
 
172
  = 4.0.4 - 2020-12-22 =
173
  * Fixed free shipping notice functionality
656
  * Added WooCommerce 2.3 compatibility
657
 
658
  = 1.0 - 2015-11-03 =
659
+ * First release!
src/WPDesk/FS/TableRate/Rule/CostsCalculator.php CHANGED
@@ -122,15 +122,6 @@ class CostsCalculator {
122
  $this->prepared_rules = $this->prepare_rules();
123
  }
124
 
125
- /**
126
- * .
127
- */
128
- public function process_shipping_rules_on_shipping_contents() {
129
- foreach ( $this->prepared_rules as $rule_index => $calculated_rule ) {
130
- $this->shipping_contents = $calculated_rule->process_shipping_contents( $this->shipping_contents );
131
- }
132
- }
133
-
134
  /**
135
  * .
136
  */
@@ -202,6 +193,9 @@ class CostsCalculator {
202
  );
203
 
204
  foreach ( $this->prepared_rules as $rule_index => $calculated_rule ) {
 
 
 
205
  $rule_cost = 0.0;
206
  $rule_logger = new ArrayLogger();
207
  $is_rule_triggered = false;
@@ -213,6 +207,7 @@ class CostsCalculator {
213
  }
214
 
215
  $this->logger->debug( $calculated_rule->format_for_log( $rule_index + 1 ), $this->logger->get_rule_context( $is_rule_triggered ) );
 
216
  $this->logger->log_from_array_logger( $rule_logger, $this->logger->get_rule_context( $is_rule_triggered ) );
217
 
218
  if ( $is_rule_triggered ) {
122
  $this->prepared_rules = $this->prepare_rules();
123
  }
124
 
 
 
 
 
 
 
 
 
 
125
  /**
126
  * .
127
  */
193
  );
194
 
195
  foreach ( $this->prepared_rules as $rule_index => $calculated_rule ) {
196
+ $this->shipping_contents->reset_contents();
197
+ $this->shipping_contents = $calculated_rule->process_shipping_contents( $this->shipping_contents );
198
+
199
  $rule_cost = 0.0;
200
  $rule_logger = new ArrayLogger();
201
  $is_rule_triggered = false;
207
  }
208
 
209
  $this->logger->debug( $calculated_rule->format_for_log( $rule_index + 1 ), $this->logger->get_rule_context( $is_rule_triggered ) );
210
+
211
  $this->logger->log_from_array_logger( $rule_logger, $this->logger->get_rule_context( $is_rule_triggered ) );
212
 
213
  if ( $is_rule_triggered ) {
src/WPDesk/FS/TableRate/Rule/Rule.php CHANGED
@@ -89,7 +89,6 @@ class Rule {
89
  * @return ShippingContents
90
  */
91
  public function process_shipping_contents( ShippingContents $shipping_contents ) {
92
- $shipping_contents->reset_contents();
93
  if ( $this->has_rule_conditions() ) {
94
  foreach ( $this->rule_settings[ self::CONDITIONS ] as $condition_settings_key => $condition_settings ) {
95
  if ( isset( $condition_settings[ self::CONDITION_ID ], $this->available_conditions[ $condition_settings[ self::CONDITION_ID ] ] ) ) {
@@ -110,7 +109,6 @@ class Rule {
110
  */
111
  public function is_rule_triggered( ShippingContents $shipping_contents, LoggerInterface $logger ) {
112
  $triggered = true;
113
- $shipping_contents = $this->process_shipping_contents( $shipping_contents );
114
  if ( $this->has_rule_conditions() ) {
115
  foreach ( $this->rule_settings[ self::CONDITIONS ] as $condition_settings_key => $condition_settings ) {
116
  if ( isset( $condition_settings[ self::CONDITION_ID ], $this->available_conditions[ $condition_settings[ self::CONDITION_ID ] ] ) ) {
@@ -142,7 +140,6 @@ class Rule {
142
  */
143
  public function get_rule_cost( ShippingContents $shipping_contents, LoggerInterface $logger ) {
144
  $logger->debug( sprintf( ' %1$s', __( 'Rule costs:', 'flexible-shipping' ) ) );
145
- $shipping_contents = $this->process_shipping_contents( $shipping_contents );
146
  $cost = 0.0;
147
  foreach ( $this->cost_fields as $cost_field ) {
148
  if ( isset( $this->rule_settings[ $cost_field->get_name() ] ) ) {
89
  * @return ShippingContents
90
  */
91
  public function process_shipping_contents( ShippingContents $shipping_contents ) {
 
92
  if ( $this->has_rule_conditions() ) {
93
  foreach ( $this->rule_settings[ self::CONDITIONS ] as $condition_settings_key => $condition_settings ) {
94
  if ( isset( $condition_settings[ self::CONDITION_ID ], $this->available_conditions[ $condition_settings[ self::CONDITION_ID ] ] ) ) {
109
  */
110
  public function is_rule_triggered( ShippingContents $shipping_contents, LoggerInterface $logger ) {
111
  $triggered = true;
 
112
  if ( $this->has_rule_conditions() ) {
113
  foreach ( $this->rule_settings[ self::CONDITIONS ] as $condition_settings_key => $condition_settings ) {
114
  if ( isset( $condition_settings[ self::CONDITION_ID ], $this->available_conditions[ $condition_settings[ self::CONDITION_ID ] ] ) ) {
140
  */
141
  public function get_rule_cost( ShippingContents $shipping_contents, LoggerInterface $logger ) {
142
  $logger->debug( sprintf( ' %1$s', __( 'Rule costs:', 'flexible-shipping' ) ) );
 
143
  $cost = 0.0;
144
  foreach ( $this->cost_fields as $cost_field ) {
145
  if ( isset( $this->rule_settings[ $cost_field->get_name() ] ) ) {
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit2bb1fc42f3b0e6bcb4c9f50161879719::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit7c2e5052bfa29fd06b5d001d370c7d1e::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit2bb1fc42f3b0e6bcb4c9f50161879719
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit2bb1fc42f3b0e6bcb4c9f50161879719
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit2bb1fc42f3b0e6bcb4c9f50161879719', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit2bb1fc42f3b0e6bcb4c9f50161879719', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
- call_user_func(\Composer\Autoload\ComposerStaticInit2bb1fc42f3b0e6bcb4c9f50161879719::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
@@ -48,19 +48,19 @@ class ComposerAutoloaderInit2bb1fc42f3b0e6bcb4c9f50161879719
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
- $includeFiles = Composer\Autoload\ComposerStaticInit2bb1fc42f3b0e6bcb4c9f50161879719::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
- composerRequire2bb1fc42f3b0e6bcb4c9f50161879719($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
- function composerRequire2bb1fc42f3b0e6bcb4c9f50161879719($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit7c2e5052bfa29fd06b5d001d370c7d1e
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit7c2e5052bfa29fd06b5d001d370c7d1e', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit7c2e5052bfa29fd06b5d001d370c7d1e', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit7c2e5052bfa29fd06b5d001d370c7d1e::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
+ $includeFiles = Composer\Autoload\ComposerStaticInit7c2e5052bfa29fd06b5d001d370c7d1e::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
+ composerRequire7c2e5052bfa29fd06b5d001d370c7d1e($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
+ function composerRequire7c2e5052bfa29fd06b5d001d370c7d1e($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit2bb1fc42f3b0e6bcb4c9f50161879719
8
  {
9
  public static $files = array (
10
  '0509b34a4bd7aebefeac629c9dc8a978' => __DIR__ . '/..' . '/wpdesk/wp-notice/src/WPDesk/notice-functions.php',
@@ -596,10 +596,10 @@ class ComposerStaticInit2bb1fc42f3b0e6bcb4c9f50161879719
596
  public static function getInitializer(ClassLoader $loader)
597
  {
598
  return \Closure::bind(function () use ($loader) {
599
- $loader->prefixLengthsPsr4 = ComposerStaticInit2bb1fc42f3b0e6bcb4c9f50161879719::$prefixLengthsPsr4;
600
- $loader->prefixDirsPsr4 = ComposerStaticInit2bb1fc42f3b0e6bcb4c9f50161879719::$prefixDirsPsr4;
601
- $loader->fallbackDirsPsr4 = ComposerStaticInit2bb1fc42f3b0e6bcb4c9f50161879719::$fallbackDirsPsr4;
602
- $loader->classMap = ComposerStaticInit2bb1fc42f3b0e6bcb4c9f50161879719::$classMap;
603
 
604
  }, null, ClassLoader::class);
605
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit7c2e5052bfa29fd06b5d001d370c7d1e
8
  {
9
  public static $files = array (
10
  '0509b34a4bd7aebefeac629c9dc8a978' => __DIR__ . '/..' . '/wpdesk/wp-notice/src/WPDesk/notice-functions.php',
596
  public static function getInitializer(ClassLoader $loader)
597
  {
598
  return \Closure::bind(function () use ($loader) {
599
+ $loader->prefixLengthsPsr4 = ComposerStaticInit7c2e5052bfa29fd06b5d001d370c7d1e::$prefixLengthsPsr4;
600
+ $loader->prefixDirsPsr4 = ComposerStaticInit7c2e5052bfa29fd06b5d001d370c7d1e::$prefixDirsPsr4;
601
+ $loader->fallbackDirsPsr4 = ComposerStaticInit7c2e5052bfa29fd06b5d001d370c7d1e::$fallbackDirsPsr4;
602
+ $loader->classMap = ComposerStaticInit7c2e5052bfa29fd06b5d001d370c7d1e::$classMap;
603
 
604
  }, null, ClassLoader::class);
605
  }