Flexible Shipping for WooCommerce - Version 4.10.1

Version Description

  • 2021-11-18 =
  • Removed unnecessary tax calculation when free shipping
Download this release

Release Info

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

Code changes from version 4.10.0 to 4.10.1

flexible-shipping.php CHANGED
@@ -3,14 +3,14 @@
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.10.0
7
  * Author: WP Desk
8
  * Author URI: https://flexibleshipping.com/?utm_source=fs&utm_medium=link&utm_campaign=plugin-list-author
9
  * Text Domain: flexible-shipping
10
  * Domain Path: /lang/
11
  * Requires at least: 5.2
12
  * Tested up to: 5.8
13
- * WC requires at least: 5.5
14
  * WC tested up to: 5.9
15
  * Requires PHP: 7.0
16
  *
@@ -38,7 +38,7 @@ if ( ! defined( 'ABSPATH' ) ) {
38
  } // Exit if accessed directly
39
 
40
  /* THIS VARIABLE CAN BE CHANGED AUTOMATICALLY */
41
- $plugin_version = '4.10.0';
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.10.1
7
  * Author: WP Desk
8
  * Author URI: https://flexibleshipping.com/?utm_source=fs&utm_medium=link&utm_campaign=plugin-list-author
9
  * Text Domain: flexible-shipping
10
  * Domain Path: /lang/
11
  * Requires at least: 5.2
12
  * Tested up to: 5.8
13
+ * WC requires at least: 5.6
14
  * WC tested up to: 5.9
15
  * Requires PHP: 7.0
16
  *
38
  } // Exit if accessed directly
39
 
40
  /* THIS VARIABLE CAN BE CHANGED AUTOMATICALLY */
41
+ $plugin_version = '4.10.1';
42
 
43
  $plugin_name = 'Flexible Shipping';
44
  $product_id = 'Flexible Shipping';
lang/flexible-shipping.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the same license as the Flexible Shipping plugin.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Flexible Shipping 4.10.0\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/flexible-shipping\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2021-11-08T16:00:12+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: flexible-shipping\n"
@@ -1530,24 +1530,24 @@ msgid "Need more? Check %1$sFlexible Shipping PRO%2$s to unleash its full potent
1530
  msgstr ""
1531
 
1532
  #. Translators: open tag, close tag.
1533
- #: src/WPDesk/FS/TableRate/views/shipping-method-settings-rules.php:66
1534
  msgid "Want to find out how the table rate works? Hop on board and %1$slet us guide you through the whole setup &rarr;%2$s"
1535
  msgstr ""
1536
 
1537
- #: src/WPDesk/FS/TableRate/views/shipping-method-settings-rules.php:75
1538
  msgid "Please mind that the ranges you define must not overlap each other and make sure there are no gaps between them."
1539
  msgstr ""
1540
 
1541
  #. Translators: open tag, close tag.
1542
- #: src/WPDesk/FS/TableRate/views/shipping-method-settings-rules.php:81
1543
  msgid "%1$sExample%2$s: If your rules are based on %1$sprice%2$s and the first range covers $0-$100, the next one should start from %1$s$100.01%2$s, not from %1$s$101%2$s, etc."
1544
  msgstr ""
1545
 
1546
- #: src/WPDesk/FS/TableRate/views/shipping-method-settings-rules.php:97
1547
  msgid "Missing rules table - settings cannot be saved!"
1548
  msgstr ""
1549
 
1550
- #: src/WPDesk/FS/TableRate/views/shipping-method-settings-rules.php:106
1551
  msgid "This is where the rules table should be displayed. If it's not, it is usually caused by the conflict with the other plugins you are currently using, JavaScript error or the caching issue. Clear your browser's cache or deactivate the plugins which may be interfering."
1552
  msgstr ""
1553
 
2
  # This file is distributed under the same license as the Flexible Shipping plugin.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Flexible Shipping 4.10.1\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/flexible-shipping\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2021-11-18T16:57:18+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: flexible-shipping\n"
1530
  msgstr ""
1531
 
1532
  #. Translators: open tag, close tag.
1533
+ #: src/WPDesk/FS/TableRate/views/shipping-method-settings-rules.php:67
1534
  msgid "Want to find out how the table rate works? Hop on board and %1$slet us guide you through the whole setup &rarr;%2$s"
1535
  msgstr ""
1536
 
1537
+ #: src/WPDesk/FS/TableRate/views/shipping-method-settings-rules.php:76
1538
  msgid "Please mind that the ranges you define must not overlap each other and make sure there are no gaps between them."
1539
  msgstr ""
1540
 
1541
  #. Translators: open tag, close tag.
1542
+ #: src/WPDesk/FS/TableRate/views/shipping-method-settings-rules.php:82
1543
  msgid "%1$sExample%2$s: If your rules are based on %1$sprice%2$s and the first range covers $0-$100, the next one should start from %1$s$100.01%2$s, not from %1$s$101%2$s, etc."
1544
  msgstr ""
1545
 
1546
+ #: src/WPDesk/FS/TableRate/views/shipping-method-settings-rules.php:98
1547
  msgid "Missing rules table - settings cannot be saved!"
1548
  msgstr ""
1549
 
1550
+ #: src/WPDesk/FS/TableRate/views/shipping-method-settings-rules.php:107
1551
  msgid "This is where the rules table should be displayed. If it's not, it is usually caused by the conflict with the other plugins you are currently using, JavaScript error or the caching issue. Clear your browser's cache or deactivate the plugins which may be interfering."
1552
  msgstr ""
1553
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://flexibleshipping.com/products/flexible-shipping-pro-woocomm
4
  Tags: table rate, table rate shipping, conditional shipping, free shipping, 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.8
7
- Stable tag: 4.10.0
8
  Requires PHP: 7.0
9
  License: GPLv3 or later
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -200,6 +200,9 @@ If you are upgrading from the old Flexible Shipping version (1.3.2, woo-flexible
200
 
201
  == Changelog ==
202
 
 
 
 
203
  = 4.10.0 - 2021-11-08 =
204
  * Removed "Default" settings - default shipping can be set by changing methods order in shipping zone
205
  * Fixed assets: notices assets enqueued only for administrators
4
  Tags: table rate, table rate shipping, conditional shipping, free shipping, 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.8
7
+ Stable tag: 4.10.1
8
  Requires PHP: 7.0
9
  License: GPLv3 or later
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
200
 
201
  == Changelog ==
202
 
203
+ = 4.10.1 - 2021-11-18 =
204
+ * Removed unnecessary tax calculation when free shipping
205
+
206
  = 4.10.0 - 2021-11-08 =
207
  * Removed "Default" settings - default shipping can be set by changing methods order in shipping zone
208
  * Fixed assets: notices assets enqueued only for administrators
src/WPDesk/FS/TableRate/Tax/TaxCalculator.php CHANGED
@@ -15,6 +15,7 @@ use FSVendor\WPDesk\FS\TableRate\Settings\MethodSettingsImplementation;
15
  class TaxCalculator {
16
 
17
  const TAXABLE = 'taxable';
 
18
 
19
  /**
20
  * @var MethodSettingsImplementation
@@ -41,7 +42,10 @@ class TaxCalculator {
41
  * @param bool $is_customer_vat_exempt .
42
  */
43
  public function append_taxes_to_rate_if_enabled( array $rate, $is_customer_vat_exempt ) {
44
- if ( wc_tax_enabled() && 'yes' === $this->method_settings->get_prices_include_tax() && self::TAXABLE === $this->method_settings->get_tax_status() ) {
 
 
 
45
  return $this->append_taxes_to_rate( $rate, $is_customer_vat_exempt );
46
  }
47
 
@@ -55,12 +59,12 @@ class TaxCalculator {
55
  * @return array
56
  */
57
  private function append_taxes_to_rate( array $rate, bool $is_customer_vat_exempt ) {
58
- $total_cost = $rate['cost'];
59
  $taxes = \WC_Tax::calc_tax( $total_cost, $this->tax_rates, true );
60
 
61
- $rate['cost'] = $total_cost - array_sum( $taxes );
62
 
63
- $rate['taxes'] = $is_customer_vat_exempt ? [] : \WC_Tax::calc_shipping_tax( $rate['cost'], $this->tax_rates );
64
 
65
  $rate['price_decimals'] = '4'; // Prevent the cost from being rounded before the tax is added.
66
 
15
  class TaxCalculator {
16
 
17
  const TAXABLE = 'taxable';
18
+ const COST = 'cost';
19
 
20
  /**
21
  * @var MethodSettingsImplementation
42
  * @param bool $is_customer_vat_exempt .
43
  */
44
  public function append_taxes_to_rate_if_enabled( array $rate, $is_customer_vat_exempt ) {
45
+ if ( wc_tax_enabled() && 'yes' === $this->method_settings->get_prices_include_tax()
46
+ && self::TAXABLE === $this->method_settings->get_tax_status()
47
+ && isset( $rate[ self::COST ] ) && 0.0 !== (float) $rate[ self::COST ]
48
+ ) {
49
  return $this->append_taxes_to_rate( $rate, $is_customer_vat_exempt );
50
  }
51
 
59
  * @return array
60
  */
61
  private function append_taxes_to_rate( array $rate, bool $is_customer_vat_exempt ) {
62
+ $total_cost = $rate[ self::COST ];
63
  $taxes = \WC_Tax::calc_tax( $total_cost, $this->tax_rates, true );
64
 
65
+ $rate[ self::COST ] = $total_cost - array_sum( $taxes );
66
 
67
+ $rate['taxes'] = $is_customer_vat_exempt ? [] : \WC_Tax::calc_shipping_tax( $rate[ self::COST ], $this->tax_rates );
68
 
69
  $rate['price_decimals'] = '4'; // Prevent the cost from being rounded before the tax is added.
70
 
src/WPDesk/FS/TableRate/views/shipping-method-settings-rules.php CHANGED
@@ -44,13 +44,14 @@ $rule_table_settings = [
44
  <?php if ( ! wpdesk_is_plugin_active( 'flexible-shipping-pro/flexible-shipping-pro.php' ) ) : ?>
45
  <p>
46
  <?php
47
- $fs_pro_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/sklep/flexible-shipping-pro-woocommerce/' : 'https://flexibleshipping.com/table-rate/';
48
 
49
  echo wp_kses_post(
50
  sprintf(
51
  // Translators: open tag, close tag.
52
  __( 'Need more? Check %1$sFlexible Shipping PRO%2$s to unleash its full potential and add advanced rules based on shipping classes, products, quantity, include additional handling fees, insurance and much more.', 'flexible-shipping' ),
53
- '<a href="' . esc_url( $fs_pro_link ) . '?utm_campaign=flexible-shipping&utm_source=user-site&utm_medium=link&utm_term=flexible-shipping-pro&utm_content=fs-shippingzone-addnew-rules" target="_blank">',
 
54
  '</a>'
55
  )
56
  );
44
  <?php if ( ! wpdesk_is_plugin_active( 'flexible-shipping-pro/flexible-shipping-pro.php' ) ) : ?>
45
  <p>
46
  <?php
47
+ $fs_pro_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/sklep/flexible-shipping-pro-woocommerce/' : 'https://flexibleshipping.com/products/flexible-shipping-pro-woocommerce/';
48
 
49
  echo wp_kses_post(
50
  sprintf(
51
  // Translators: open tag, close tag.
52
  __( 'Need more? Check %1$sFlexible Shipping PRO%2$s to unleash its full potential and add advanced rules based on shipping classes, products, quantity, include additional handling fees, insurance and much more.', 'flexible-shipping' ),
53
+ '<a href="' . esc_url( $fs_pro_link ) . '?utm_campaign=fs-hints&utm_source=user-site&utm_medium=link
54
+ " target="_blank">',
55
  '</a>'
56
  )
57
  );
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInite7bfabf235d31ac3f2cad8dbef5e72c8::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInitf929054d750d9e7963097b1927623354::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInite7bfabf235d31ac3f2cad8dbef5e72c8
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInite7bfabf235d31ac3f2cad8dbef5e72c8
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInite7bfabf235d31ac3f2cad8dbef5e72c8', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
- spl_autoload_unregister(array('ComposerAutoloaderInite7bfabf235d31ac3f2cad8dbef5e72c8', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
- call_user_func(\Composer\Autoload\ComposerStaticInite7bfabf235d31ac3f2cad8dbef5e72c8::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInitf929054d750d9e7963097b1927623354
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInitf929054d750d9e7963097b1927623354', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
+ spl_autoload_unregister(array('ComposerAutoloaderInitf929054d750d9e7963097b1927623354', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
+ call_user_func(\Composer\Autoload\ComposerStaticInitf929054d750d9e7963097b1927623354::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInite7bfabf235d31ac3f2cad8dbef5e72c8
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'P' =>
@@ -607,10 +607,10 @@ class ComposerStaticInite7bfabf235d31ac3f2cad8dbef5e72c8
607
  public static function getInitializer(ClassLoader $loader)
608
  {
609
  return \Closure::bind(function () use ($loader) {
610
- $loader->prefixLengthsPsr4 = ComposerStaticInite7bfabf235d31ac3f2cad8dbef5e72c8::$prefixLengthsPsr4;
611
- $loader->prefixDirsPsr4 = ComposerStaticInite7bfabf235d31ac3f2cad8dbef5e72c8::$prefixDirsPsr4;
612
- $loader->fallbackDirsPsr4 = ComposerStaticInite7bfabf235d31ac3f2cad8dbef5e72c8::$fallbackDirsPsr4;
613
- $loader->classMap = ComposerStaticInite7bfabf235d31ac3f2cad8dbef5e72c8::$classMap;
614
 
615
  }, null, ClassLoader::class);
616
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInitf929054d750d9e7963097b1927623354
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'P' =>
607
  public static function getInitializer(ClassLoader $loader)
608
  {
609
  return \Closure::bind(function () use ($loader) {
610
+ $loader->prefixLengthsPsr4 = ComposerStaticInitf929054d750d9e7963097b1927623354::$prefixLengthsPsr4;
611
+ $loader->prefixDirsPsr4 = ComposerStaticInitf929054d750d9e7963097b1927623354::$prefixDirsPsr4;
612
+ $loader->fallbackDirsPsr4 = ComposerStaticInitf929054d750d9e7963097b1927623354::$fallbackDirsPsr4;
613
+ $loader->classMap = ComposerStaticInitf929054d750d9e7963097b1927623354::$classMap;
614
 
615
  }, null, ClassLoader::class);
616
  }