Version Description
- 2016-10-26 =
- Tweaked support for the default "Rest of the world" shipping zone
- Added support for "Network activated" WooCommerce on Multisite installations
Download this release
Release Info
Developer | wpdesk |
Plugin | Flexible Shipping for WooCommerce |
Version | 1.6.2 |
Comparing to | |
See all releases |
Code changes from version 1.6.1 to 1.6.2
- classes/shipping_method.php +4 -0
- flexible-shipping.php +35 -2
- readme.txt +5 -1
classes/shipping_method.php
CHANGED
@@ -574,6 +574,10 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping' ) ) {
|
|
574 |
public function get_all_rates() {
|
575 |
if ( class_exists( 'WC_Shipping_Zones' ) ) {
|
576 |
$zones = WC_Shipping_Zones::get_zones();
|
|
|
|
|
|
|
|
|
577 |
$rates = array();
|
578 |
foreach ( $zones as $zone ) {
|
579 |
foreach ( $zone['shipping_methods'] as $instance_id => $woo_shipping_method ) {
|
574 |
public function get_all_rates() {
|
575 |
if ( class_exists( 'WC_Shipping_Zones' ) ) {
|
576 |
$zones = WC_Shipping_Zones::get_zones();
|
577 |
+
$zone0 = WC_Shipping_Zones::get_zone(0);
|
578 |
+
$zones[0] = $zone0->get_data();
|
579 |
+
$zones[0]['formatted_zone_location'] = $zone0->get_formatted_location();
|
580 |
+
$zones[0]['shipping_methods'] = $zone0->get_shipping_methods();
|
581 |
$rates = array();
|
582 |
foreach ( $zones as $zone ) {
|
583 |
foreach ( $zone['shipping_methods'] as $instance_id => $woo_shipping_method ) {
|
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 shipping methods in WooCommerce and enable pricing based on cart weight or total.
|
6 |
-
Version: 1.6.
|
7 |
Author: WP Desk
|
8 |
Author URI: https://www.wpdesk.net/
|
9 |
Text Domain: flexible-shipping
|
@@ -35,7 +35,20 @@ if (!class_exists('inspire_Plugin4')) {
|
|
35 |
require_once('classes/inspire/plugin4.php');
|
36 |
}
|
37 |
|
38 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
class WPDesk_Flexible_Shipping_Free_Plugin extends inspire_Plugin4 {
|
41 |
|
@@ -189,6 +202,26 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
|
|
189 |
|
190 |
}
|
191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
function flexible_shipping_method_selected( $order_id, $shipping_method_integration ) {
|
193 |
$order = new WC_Order( $order_id );
|
194 |
$shippings = $order->get_shipping_methods();
|
3 |
Plugin Name: Flexible Shipping
|
4 |
Plugin URI: https://wordpress.org/plugins/flexible-shipping/
|
5 |
Description: Create additional shipping methods in WooCommerce and enable pricing based on cart weight or total.
|
6 |
+
Version: 1.6.2
|
7 |
Author: WP Desk
|
8 |
Author URI: https://www.wpdesk.net/
|
9 |
Text Domain: flexible-shipping
|
35 |
require_once('classes/inspire/plugin4.php');
|
36 |
}
|
37 |
|
38 |
+
if ( !function_exists( 'wpdesk_is_plugin_active' ) ) {
|
39 |
+
function wpdesk_is_plugin_active( $plugin_file ) {
|
40 |
+
|
41 |
+
$active_plugins = (array) get_option( 'active_plugins', array() );
|
42 |
+
|
43 |
+
if ( is_multisite() ) {
|
44 |
+
$active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
|
45 |
+
}
|
46 |
+
|
47 |
+
return in_array( $plugin_file, $active_plugins ) || array_key_exists( $plugin_file, $active_plugins );
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
if ( wpdesk_is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
|
52 |
|
53 |
class WPDesk_Flexible_Shipping_Free_Plugin extends inspire_Plugin4 {
|
54 |
|
202 |
|
203 |
}
|
204 |
|
205 |
+
function flexible_shipping_method_selected_in_cart( $shipping_method_integration ) {
|
206 |
+
global $woocommerce;
|
207 |
+
$shippings = $woocommerce->session->get('chosen_shipping_methods');
|
208 |
+
$all_shipping_methods = WC()->shipping()->get_shipping_methods();
|
209 |
+
if ( empty( $all_shipping_methods ) ) {
|
210 |
+
$all_shipping_methods = WC()->shipping()->load_shipping_methods();
|
211 |
+
}
|
212 |
+
$flexible_shipping = $all_shipping_methods['flexible_shipping'];
|
213 |
+
$flexible_shipping_rates = $flexible_shipping->get_all_rates();
|
214 |
+
foreach ( $shippings as $id => $shipping ) {
|
215 |
+
if ( isset( $flexible_shipping_rates[$shipping] ) ) {
|
216 |
+
$shipping_method = $flexible_shipping_rates[$shipping];
|
217 |
+
if ( $shipping_method['method_integration'] == $shipping_method_integration ) {
|
218 |
+
return $shipping_method;
|
219 |
+
}
|
220 |
+
}
|
221 |
+
}
|
222 |
+
return false;
|
223 |
+
}
|
224 |
+
|
225 |
function flexible_shipping_method_selected( $order_id, $shipping_method_integration ) {
|
226 |
$order = new WC_Order( $order_id );
|
227 |
$shippings = $order->get_shipping_methods();
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.wpdesk.net/products/flexible-shipping-pro-woocommerce/
|
|
4 |
Tags: table rate, table rate shipping, woocommerce shipping, flexible shipping, woocommerce table rate shipping, cart total, weight shipping, weight based shipping, totals based shipping, order based shipping, shipping zones, shipping classes
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 4.6.1
|
7 |
-
Stable tag: 1.6.
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -124,6 +124,10 @@ If you are upgrading from the old Flexible Shipping version (1.3.2, woo-flexible
|
|
124 |
|
125 |
== Changelog ==
|
126 |
|
|
|
|
|
|
|
|
|
127 |
= 1.6.1 - 2016-10-14 =
|
128 |
* Added information about DHL WooCommerce integration
|
129 |
|
4 |
Tags: table rate, table rate shipping, woocommerce shipping, flexible shipping, woocommerce table rate shipping, cart total, weight shipping, weight based shipping, totals based shipping, order based shipping, shipping zones, shipping classes
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 4.6.1
|
7 |
+
Stable tag: 1.6.2
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
124 |
|
125 |
== Changelog ==
|
126 |
|
127 |
+
= 1.6.2 - 2016-10-26 =
|
128 |
+
* Tweaked support for the default "Rest of the world" shipping zone
|
129 |
+
* Added support for "Network activated" WooCommerce on Multisite installations
|
130 |
+
|
131 |
= 1.6.1 - 2016-10-14 =
|
132 |
* Added information about DHL WooCommerce integration
|
133 |
|