Version Description
- 2019-02-04 =
- Fixed parameters order in notice constructor
- Fixed default shipment method in cart/checkout
Download this release
Release Info
Developer | jablonowski |
Plugin | Flexible Shipping for WooCommerce |
Version | 3.1.5 |
Comparing to | |
See all releases |
Code changes from version 3.1.4 to 3.1.5
- classes/class-flexible-shipping-plugin.php +17 -12
- classes/saas/class-saas-live-rates-fallback-metadata-handler.php +1 -2
- classes/saas/class-saas-live-rates-handler.php +5 -5
- classes/saas/class-saas-registration-second-notice.php +1 -1
- classes/saas/class-saas-user-registration.php +1 -1
- classes/shipping-method.php +5 -14
- flexible-shipping.php +2 -2
- readme.txt +5 -1
- vendor/autoload.php +1 -1
- vendor/composer/autoload_real.php +7 -7
- vendor/composer/autoload_static.php +4 -4
classes/class-flexible-shipping-plugin.php
CHANGED
@@ -185,7 +185,7 @@ class Flexible_Shipping_Plugin
|
|
185 |
add_action( 'flexible_shipping_method_rate_id', array( $this, 'flexible_shipping_method_rate_id' ), 9999999,
|
186 |
2 );
|
187 |
|
188 |
-
add_filter( 'woocommerce_shipping_chosen_method', array( $this, '
|
189 |
|
190 |
add_action( 'woocommerce_checkout_update_order_meta', array(
|
191 |
$this,
|
@@ -314,24 +314,29 @@ class Flexible_Shipping_Plugin
|
|
314 |
}
|
315 |
|
316 |
/**
|
317 |
-
*
|
318 |
-
* @param $available_methods
|
319 |
*
|
320 |
-
* @
|
|
|
|
|
|
|
|
|
321 |
*/
|
322 |
-
function
|
323 |
-
$
|
324 |
-
if ( isset( $chosen_shipping_methods[0] ) ) {
|
325 |
foreach ( $available_methods as $available_method ) {
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
|
|
330 |
}
|
331 |
}
|
|
|
|
|
332 |
}
|
333 |
|
334 |
-
return $
|
335 |
}
|
336 |
|
337 |
/**
|
185 |
add_action( 'flexible_shipping_method_rate_id', array( $this, 'flexible_shipping_method_rate_id' ), 9999999,
|
186 |
2 );
|
187 |
|
188 |
+
add_filter( 'woocommerce_shipping_chosen_method', array( $this, 'woocommerce_default_shipment_method' ), 10, 3 );
|
189 |
|
190 |
add_action( 'woocommerce_checkout_update_order_meta', array(
|
191 |
$this,
|
314 |
}
|
315 |
|
316 |
/**
|
317 |
+
* Set appropriate default FS method if no method chosen.
|
|
|
318 |
*
|
319 |
+
* @param string $default Default shipping method in frontend
|
320 |
+
* @param \WC_Shipping_Rate[] $available_methods Available methods in frontend
|
321 |
+
* @param string|bool|null $chosen_method If false or null then no method is chosen
|
322 |
+
*
|
323 |
+
* @return string
|
324 |
*/
|
325 |
+
function woocommerce_default_shipment_method( $default, array $available_methods, $chosen_method ) {
|
326 |
+
if ( $chosen_method === null || $chosen_method === false ) {
|
|
|
327 |
foreach ( $available_methods as $available_method ) {
|
328 |
+
$method_meta = $available_method->get_meta_data();
|
329 |
+
$default_meta_key = WPDesk_Flexible_Shipping::META_DEFAULT;
|
330 |
+
|
331 |
+
if ( $method_meta && isset( $method_meta[ $default_meta_key ] ) && $method_meta[ $default_meta_key ] === 'yes' ) {
|
332 |
+
return $available_method->get_id();
|
333 |
}
|
334 |
}
|
335 |
+
|
336 |
+
return $default;
|
337 |
}
|
338 |
|
339 |
+
return $chosen_method;
|
340 |
}
|
341 |
|
342 |
/**
|
classes/saas/class-saas-live-rates-fallback-metadata-handler.php
CHANGED
@@ -7,7 +7,6 @@ class WPDesk_Flexible_Shipping_SaaS_Live_Rates_Fallback_Metadata_Handler impleme
|
|
7 |
|
8 |
use \WPDesk\PluginBuilder\Plugin\PluginAccess;
|
9 |
|
10 |
-
const META_DEFAULT = '_default';
|
11 |
const MATA_FS_FALLBACK = '_fs_fallback';
|
12 |
const META_FS_RATE_TYPE = '_fs_rate_type';
|
13 |
|
@@ -50,7 +49,7 @@ class WPDesk_Flexible_Shipping_SaaS_Live_Rates_Fallback_Metadata_Handler impleme
|
|
50 |
* @return array
|
51 |
*/
|
52 |
public function hide_fallback_meta( array $items ) {
|
53 |
-
$items[] =
|
54 |
$items[] = self::MATA_FS_FALLBACK;
|
55 |
$items[] = self::META_FS_RATE_TYPE;
|
56 |
return $items;
|
7 |
|
8 |
use \WPDesk\PluginBuilder\Plugin\PluginAccess;
|
9 |
|
|
|
10 |
const MATA_FS_FALLBACK = '_fs_fallback';
|
11 |
const META_FS_RATE_TYPE = '_fs_rate_type';
|
12 |
|
49 |
* @return array
|
50 |
*/
|
51 |
public function hide_fallback_meta( array $items ) {
|
52 |
+
$items[] = WPDesk_Flexible_Shipping::META_DEFAULT;
|
53 |
$items[] = self::MATA_FS_FALLBACK;
|
54 |
$items[] = self::META_FS_RATE_TYPE;
|
55 |
return $items;
|
classes/saas/class-saas-live-rates-handler.php
CHANGED
@@ -402,11 +402,11 @@ class WPDesk_Flexible_Shipping_SaaS_Live_Rates_Handler {
|
|
402 |
'meta_data' => array(
|
403 |
'_fs_method' => $shipping_method,
|
404 |
self::FS_RATE_TYPE => self::RATE_TYPE_LIVE,
|
405 |
-
'_fs_saas_data'
|
406 |
-
|
407 |
-
'_fs_service_type'
|
408 |
-
'_fs_service_name'
|
409 |
-
'_fs_live_rate_response'
|
410 |
),
|
411 |
),
|
412 |
) );
|
402 |
'meta_data' => array(
|
403 |
'_fs_method' => $shipping_method,
|
404 |
self::FS_RATE_TYPE => self::RATE_TYPE_LIVE,
|
405 |
+
'_fs_saas_data' => array(
|
406 |
+
WPDesk_Flexible_Shipping::META_DEFAULT => $shipping_method['method_default'],
|
407 |
+
'_fs_service_type' => $rate->serviceType,
|
408 |
+
'_fs_service_name' => $rate->serviceName,
|
409 |
+
'_fs_live_rate_response' => $live_rate_response,
|
410 |
),
|
411 |
),
|
412 |
) );
|
classes/saas/class-saas-registration-second-notice.php
CHANGED
@@ -73,8 +73,8 @@ class WPDesk_Flexible_Shipping_SaaS_Registration_Second_Notice
|
|
73 |
$notice_content = $this->get_notice_content();
|
74 |
new \WPDesk\Notice\PermanentDismissibleNotice(
|
75 |
$notice_content,
|
76 |
-
\WPDesk\Notice\Notice::NOTICE_TYPE_INFO,
|
77 |
self::SECOND_NOTICE_NAME,
|
|
|
78 |
10,
|
79 |
array(
|
80 |
'class' => self::SECOND_NOTICE_NAME,
|
73 |
$notice_content = $this->get_notice_content();
|
74 |
new \WPDesk\Notice\PermanentDismissibleNotice(
|
75 |
$notice_content,
|
|
|
76 |
self::SECOND_NOTICE_NAME,
|
77 |
+
\WPDesk\Notice\Notice::NOTICE_TYPE_INFO,
|
78 |
10,
|
79 |
array(
|
80 |
'class' => self::SECOND_NOTICE_NAME,
|
classes/saas/class-saas-user-registration.php
CHANGED
@@ -426,8 +426,8 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_SaaS_User_Registration' ) ) {
|
|
426 |
if ( ! $this->is_on_setings_page() && ! $this->is_on_registration_page() ) {
|
427 |
new \WPDesk\Notice\PermanentDismissibleNotice(
|
428 |
$notice_content,
|
429 |
-
\WPDesk\Notice\Notice::NOTICE_TYPE_INFO,
|
430 |
self::FS_CONNECT_FIRST_NOTICE_NAME,
|
|
|
431 |
10,
|
432 |
array(
|
433 |
'class' => 'fs-connect__container',
|
426 |
if ( ! $this->is_on_setings_page() && ! $this->is_on_registration_page() ) {
|
427 |
new \WPDesk\Notice\PermanentDismissibleNotice(
|
428 |
$notice_content,
|
|
|
429 |
self::FS_CONNECT_FIRST_NOTICE_NAME,
|
430 |
+
\WPDesk\Notice\Notice::NOTICE_TYPE_INFO,
|
431 |
10,
|
432 |
array(
|
433 |
'class' => 'fs-connect__container',
|
classes/shipping-method.php
CHANGED
@@ -5,12 +5,13 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|
5 |
if ( ! class_exists( 'WPDesk_Flexible_Shipping' ) ) {
|
6 |
class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
|
7 |
|
8 |
-
const FIELD_METHOD_FREE_SHIPPING='method_free_shipping';
|
9 |
|
10 |
-
|
11 |
|
12 |
private $message_added = false;
|
13 |
|
|
|
14 |
/**
|
15 |
* Constructor for your shipment class
|
16 |
*
|
@@ -824,8 +825,6 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping' ) ) {
|
|
824 |
|
825 |
$processed = apply_filters( 'flexible_shipping_calculate_shipping', false, $this, $package, 0 );
|
826 |
|
827 |
-
$default_method_is_set = false;
|
828 |
-
|
829 |
if ( $processed === false ) {
|
830 |
|
831 |
$shipping_methods = $this->get_shipping_methods( true );
|
@@ -926,8 +925,8 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping' ) ) {
|
|
926 |
'method' => $shipping_method,
|
927 |
'rule_costs' => $rule_costs,
|
928 |
'meta_data' => array(
|
929 |
-
|
930 |
-
'_fs_method'
|
931 |
)
|
932 |
) );
|
933 |
if ( isset( $shipping_method['method_description'] ) ) {
|
@@ -936,14 +935,6 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping' ) ) {
|
|
936 |
else {
|
937 |
WC()->session->set( 'flexible_shipping_description_' . $id, '' );
|
938 |
}
|
939 |
-
if ( !$default_method_is_set && isset( $shipping_method['method_default'] ) && $shipping_method['method_default'] == 'yes' ) {
|
940 |
-
$chosen_shipping_methods = WC()->session->get( 'chosen_shipping_methods', array() );
|
941 |
-
if ( !isset( $chosen_shipping_methods[0] ) ) {
|
942 |
-
$chosen_shipping_methods[0] = $id;
|
943 |
-
WC()->session->set('chosen_shipping_methods', $chosen_shipping_methods );
|
944 |
-
$default_method_is_set = true;
|
945 |
-
}
|
946 |
-
}
|
947 |
}
|
948 |
}
|
949 |
}
|
5 |
if ( ! class_exists( 'WPDesk_Flexible_Shipping' ) ) {
|
6 |
class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
|
7 |
|
8 |
+
const FIELD_METHOD_FREE_SHIPPING = 'method_free_shipping';
|
9 |
|
10 |
+
const META_DEFAULT = '_default';
|
11 |
|
12 |
private $message_added = false;
|
13 |
|
14 |
+
|
15 |
/**
|
16 |
* Constructor for your shipment class
|
17 |
*
|
825 |
|
826 |
$processed = apply_filters( 'flexible_shipping_calculate_shipping', false, $this, $package, 0 );
|
827 |
|
|
|
|
|
828 |
if ( $processed === false ) {
|
829 |
|
830 |
$shipping_methods = $this->get_shipping_methods( true );
|
925 |
'method' => $shipping_method,
|
926 |
'rule_costs' => $rule_costs,
|
927 |
'meta_data' => array(
|
928 |
+
self::META_DEFAULT => $shipping_method['method_default'],
|
929 |
+
'_fs_method' => $shipping_method
|
930 |
)
|
931 |
) );
|
932 |
if ( isset( $shipping_method['method_description'] ) ) {
|
935 |
else {
|
936 |
WC()->session->set( 'flexible_shipping_description_' . $id, '' );
|
937 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
938 |
}
|
939 |
}
|
940 |
}
|
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: 3.1.
|
7 |
Author: WP Desk
|
8 |
Author URI: https://www.wpdesk.net/
|
9 |
Text Domain: flexible-shipping
|
@@ -43,7 +43,7 @@ if ( ! class_exists( 'WPDesk_Basic_Requirement_Checker' ) ) {
|
|
43 |
|
44 |
|
45 |
/* THESE TWO VARIABLES CAN BE CHANGED AUTOMATICALLY */
|
46 |
-
$plugin_version = '3.1.
|
47 |
$plugin_release_timestamp = '2018-11-28';
|
48 |
|
49 |
$plugin_name = '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: 3.1.5
|
7 |
Author: WP Desk
|
8 |
Author URI: https://www.wpdesk.net/
|
9 |
Text Domain: flexible-shipping
|
43 |
|
44 |
|
45 |
/* THESE TWO VARIABLES CAN BE CHANGED AUTOMATICALLY */
|
46 |
+
$plugin_version = '3.1.5';
|
47 |
$plugin_release_timestamp = '2018-11-28';
|
48 |
|
49 |
$plugin_name = 'Flexible Shipping';
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://flexibleshipping.com/table-rate/
|
|
4 |
Tags: table rate, table rate 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
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 5.0.3
|
7 |
-
Stable tag: 3.1.
|
8 |
Requires PHP: 5.6
|
9 |
License: GPLv3 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
@@ -175,6 +175,10 @@ If you are upgrading from the old Flexible Shipping version (1.3.2, woo-flexible
|
|
175 |
|
176 |
== Changelog ==
|
177 |
|
|
|
|
|
|
|
|
|
178 |
= 3.1.4 - 2019-01-28 =
|
179 |
|
180 |
* Fixed fatal when free shipment
|
4 |
Tags: table rate, table rate 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
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 5.0.3
|
7 |
+
Stable tag: 3.1.5
|
8 |
Requires PHP: 5.6
|
9 |
License: GPLv3 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
175 |
|
176 |
== Changelog ==
|
177 |
|
178 |
+
= 3.1.5 - 2019-02-04 =
|
179 |
+
* Fixed parameters order in notice constructor
|
180 |
+
* Fixed default shipment method in cart/checkout
|
181 |
+
|
182 |
= 3.1.4 - 2019-01-28 =
|
183 |
|
184 |
* Fixed fatal when free shipment
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInit807a2cc88a434c4f0cc2747b964dd5bb::getLoader();
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit0abb6024cd534528a5558a8a60d2554d
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
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\
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
@@ -48,19 +48,19 @@ class ComposerAutoloaderInit0abb6024cd534528a5558a8a60d2554d
|
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
-
$includeFiles = Composer\Autoload\
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
-
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
-
function
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit807a2cc88a434c4f0cc2747b964dd5bb
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit807a2cc88a434c4f0cc2747b964dd5bb', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit807a2cc88a434c4f0cc2747b964dd5bb', '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\ComposerStaticInit807a2cc88a434c4f0cc2747b964dd5bb::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\ComposerStaticInit807a2cc88a434c4f0cc2747b964dd5bb::$files;
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
+
composerRequire807a2cc88a434c4f0cc2747b964dd5bb($fileIdentifier, $file);
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
+
function composerRequire807a2cc88a434c4f0cc2747b964dd5bb($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
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'46ae4ad8c3479aabff48f598a0e4b93f' => __DIR__ . '/..' . '/wpdesk/wp-mutex/src/WPDesk/functions.php',
|
@@ -598,9 +598,9 @@ class ComposerStaticInit0abb6024cd534528a5558a8a60d2554d
|
|
598 |
public static function getInitializer(ClassLoader $loader)
|
599 |
{
|
600 |
return \Closure::bind(function () use ($loader) {
|
601 |
-
$loader->prefixLengthsPsr4 =
|
602 |
-
$loader->prefixDirsPsr4 =
|
603 |
-
$loader->classMap =
|
604 |
|
605 |
}, null, ClassLoader::class);
|
606 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit807a2cc88a434c4f0cc2747b964dd5bb
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'46ae4ad8c3479aabff48f598a0e4b93f' => __DIR__ . '/..' . '/wpdesk/wp-mutex/src/WPDesk/functions.php',
|
598 |
public static function getInitializer(ClassLoader $loader)
|
599 |
{
|
600 |
return \Closure::bind(function () use ($loader) {
|
601 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit807a2cc88a434c4f0cc2747b964dd5bb::$prefixLengthsPsr4;
|
602 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit807a2cc88a434c4f0cc2747b964dd5bb::$prefixDirsPsr4;
|
603 |
+
$loader->classMap = ComposerStaticInit807a2cc88a434c4f0cc2747b964dd5bb::$classMap;
|
604 |
|
605 |
}, null, ClassLoader::class);
|
606 |
}
|