Version Description
26-09-2017 =
[Add] - Helpful resources meta box
[Tested] - WooCommerce 3.2
[Improvement] - Update WP Conditions to 1.0.5 - [Improvement] - WC 3.2 changes to prevent notices
Download this release
Release Info
Developer | sormano |
Plugin | WooCommerce Advanced Free Shipping |
Version | 1.1.3 |
Comparing to | |
See all releases |
Code changes from version 1.1.2 to 1.1.3
- includes/admin/class-wafs-admin.php +4 -1
- includes/class-wafs-post-type.php +21 -0
- libraries/wp-conditions/conditions/wpc-shipping-method-condition.php +2 -2
- libraries/wp-conditions/conditions/wpc-subtotal-ex-tax-condition.php +4 -0
- libraries/wp-conditions/conditions/wpc-tax-condition.php +4 -0
- libraries/wp-conditions/readme.txt +9 -1
- readme.txt +13 -2
- woocommerce-advanced-free-shipping.php +22 -24
includes/admin/class-wafs-admin.php
CHANGED
@@ -18,7 +18,10 @@ class WAFS_Admin {
|
|
18 |
*
|
19 |
* @since 1.0.8
|
20 |
*/
|
21 |
-
public function __construct() {
|
|
|
|
|
|
|
22 |
|
23 |
|
24 |
/**
|
18 |
*
|
19 |
* @since 1.0.8
|
20 |
*/
|
21 |
+
public function __construct() {
|
22 |
+
// Initialize class
|
23 |
+
add_action( 'admin_init', array( $this, 'init' ) );
|
24 |
+
}
|
25 |
|
26 |
|
27 |
/**
|
includes/class-wafs-post-type.php
CHANGED
@@ -135,6 +135,7 @@ class WAFS_post_type {
|
|
135 |
|
136 |
add_meta_box( 'wafs_conditions', __( 'Advanced Free Shipping conditions', 'woocommerce-advanced-free-shipping' ), array( $this, 'render_wafs_conditions' ), 'wafs', 'normal' );
|
137 |
add_meta_box( 'wafs_settings', __( 'Shipping settings', 'woocommerce-advanced-free-shipping' ), array( $this, 'render_wafs_settings' ), 'wafs', 'normal' );
|
|
|
138 |
|
139 |
}
|
140 |
|
@@ -163,6 +164,26 @@ class WAFS_post_type {
|
|
163 |
}
|
164 |
|
165 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
/**
|
167 |
* Save settings meta box.
|
168 |
*
|
135 |
|
136 |
add_meta_box( 'wafs_conditions', __( 'Advanced Free Shipping conditions', 'woocommerce-advanced-free-shipping' ), array( $this, 'render_wafs_conditions' ), 'wafs', 'normal' );
|
137 |
add_meta_box( 'wafs_settings', __( 'Shipping settings', 'woocommerce-advanced-free-shipping' ), array( $this, 'render_wafs_settings' ), 'wafs', 'normal' );
|
138 |
+
add_meta_box( 'wafs_resources', __( 'Useful links', 'woocommerce-advanced-free-shipping' ), array( $this, 'render_wafs_resources' ), 'wafs', 'side' );
|
139 |
|
140 |
}
|
141 |
|
164 |
}
|
165 |
|
166 |
|
167 |
+
/**
|
168 |
+
* Show resources MB contents.
|
169 |
+
*
|
170 |
+
* @since 1.1.3
|
171 |
+
*/
|
172 |
+
function render_wafs_resources() {
|
173 |
+
|
174 |
+
?><ul>
|
175 |
+
<li><a href="http://jeroensormani.com/how-the-advanced-plugin-conditions-work?utm_source=WAFS-plugin&utm_medium=website&utm_campaign=WAFS-helpful-links" target="_blank"><?php _e( 'How the conditions work', 'woocommerce-advanced-free-shipping' ); ?></a></li>
|
176 |
+
<li><a href="http://jeroensormani.com/apply-free-shipping-for-specific-products-in-woocommerce?utm_source=WAFS-plugin&utm_medium=website&utm_campaign=WAFS-helpful-links" target="_blank"><?php _e( 'Applying free shipping to specific products', 'woocommerce-advanced-free-shipping' ); ?></a></li>
|
177 |
+
<li><a href="http://jeroensormani.com/showing-add-10-free-shipping-notice#showing-a-free-shipping-notice-for-advanced-shipping?utm_source=WAFS-plugin&utm_medium=website&utm_campaign=WAFS-helpful-links" target="_blank"><?php _e( 'Showing a free shipping message', 'woocommerce-advanced-free-shipping' ); ?></a></li>
|
178 |
+
<li><a href="http://jeroensormani.com/shipping-debug-mode?utm_source=WAFS-plugin&utm_medium=website&utm_campaign=WAFS-helpful-links" target="_blank"><?php _e( 'Disabling the shipping cache', 'woocommerce-advanced-free-shipping' ); ?></a></li>
|
179 |
+
<li><a href="http://codecanyon.net/item/woocommerce-advanced-shipping/8634573" target="_blank"><?php _e( 'Apply shipping cost using conditions', 'woocommerce-advanced-free-shipping' ); ?></a></li>
|
180 |
+
<hr />
|
181 |
+
<li><a href="http://jeroensormani.com/contact?utm_source=WAFS-plugin&utm_medium=website&utm_campaign=WAFS-helpful-links" target="_blank"><?php _e( 'Hire me for custom condition development', 'woocommerce-advanced-free-shipping' ); ?></a></li>
|
182 |
+
</ul><?php
|
183 |
+
|
184 |
+
}
|
185 |
+
|
186 |
+
|
187 |
/**
|
188 |
* Save settings meta box.
|
189 |
*
|
libraries/wp-conditions/conditions/wpc-shipping-method-condition.php
CHANGED
@@ -58,8 +58,8 @@ if ( ! class_exists( 'WPC_Shipping_Method_Condition' ) ) {
|
|
58 |
private function get_shipping_options() {
|
59 |
|
60 |
$shipping_options = array();
|
61 |
-
foreach ( WC()->shipping->load_shipping_methods() as $method ) :
|
62 |
-
$shipping_options['Methods'][ $method->id ] = $method->
|
63 |
endforeach;
|
64 |
|
65 |
// Advanced Shipping
|
58 |
private function get_shipping_options() {
|
59 |
|
60 |
$shipping_options = array();
|
61 |
+
foreach ( WC()->shipping()->load_shipping_methods() as $method ) :
|
62 |
+
$shipping_options['Methods'][ $method->id ] = $method->get_method_title();
|
63 |
endforeach;
|
64 |
|
65 |
// Advanced Shipping
|
libraries/wp-conditions/conditions/wpc-subtotal-ex-tax-condition.php
CHANGED
@@ -19,6 +19,10 @@ if ( ! class_exists( 'WPC_Subtotal_Ex_Tax_Condition' ) ) {
|
|
19 |
}
|
20 |
|
21 |
public function get_compare_value() {
|
|
|
|
|
|
|
|
|
22 |
return WC()->cart->subtotal_ex_tax;
|
23 |
}
|
24 |
|
19 |
}
|
20 |
|
21 |
public function get_compare_value() {
|
22 |
+
if ( method_exists( WC()->cart, 'get_subtotal' ) ) { // WC 3.2+
|
23 |
+
return WC()->cart->get_subtotal();
|
24 |
+
}
|
25 |
+
|
26 |
return WC()->cart->subtotal_ex_tax;
|
27 |
}
|
28 |
|
libraries/wp-conditions/conditions/wpc-tax-condition.php
CHANGED
@@ -19,6 +19,10 @@ if ( ! class_exists( 'WPC_Tax_Condition' ) ) {
|
|
19 |
}
|
20 |
|
21 |
public function get_compare_value() {
|
|
|
|
|
|
|
|
|
22 |
return array_sum( (array) WC()->cart->taxes );
|
23 |
}
|
24 |
|
19 |
}
|
20 |
|
21 |
public function get_compare_value() {
|
22 |
+
if ( method_exists( WC()->cart, 'get_cart_contents_tax' ) ) { // WC 3.2+
|
23 |
+
return WC()->cart->get_cart_contents_tax();
|
24 |
+
}
|
25 |
+
|
26 |
return array_sum( (array) WC()->cart->taxes );
|
27 |
}
|
28 |
|
libraries/wp-conditions/readme.txt
CHANGED
@@ -4,10 +4,18 @@ It is intended to be used on plugins like build by Jeroen such as Advanced Shipp
|
|
4 |
Copyright © 2017 Jeroen Sormani
|
5 |
|
6 |
|
7 |
-
# Current version: 1.0.
|
8 |
|
9 |
# Changelog
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
= 1.0.3 - 28/06/2017 =
|
12 |
|
13 |
- [Fix] - 'User role' condition 'Guest' wasn't working
|
4 |
Copyright © 2017 Jeroen Sormani
|
5 |
|
6 |
|
7 |
+
# Current version: 1.0.5
|
8 |
|
9 |
# Changelog
|
10 |
|
11 |
+
= 1.0.5 - 26/09/2017 =
|
12 |
+
|
13 |
+
- [Improvement] - WC 3.2 changes to prevent notices
|
14 |
+
|
15 |
+
= 1.0.4 - 01/09/2017 =
|
16 |
+
|
17 |
+
- [Improvement] - Use WC_Method:get_method_title() instead of get_title() to get method title.
|
18 |
+
|
19 |
= 1.0.3 - 28/06/2017 =
|
20 |
|
21 |
- [Fix] - 'User role' condition 'Guest' wasn't working
|
readme.txt
CHANGED
@@ -2,8 +2,9 @@
|
|
2 |
Contributors: sormano
|
3 |
Tags: woocommerce shipping, woocommerce, shipping, woocommerce free shipping, woocommerce free, woocommerce advanced free shipping, wc free shipping, wc shipping, advanced shipping, pro shipping, table rate shipping, country shipping, free shipping
|
4 |
Requires at least: 4.0
|
5 |
-
Tested up to: 4.
|
6 |
-
Stable tag: 1.1.
|
|
|
7 |
License: GPLv3 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
@@ -100,6 +101,16 @@ In the future this will likely be changed, for now I recommend taking a look at
|
|
100 |
|
101 |
== Changelog ==
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
= 1.1.2 - 29-06-2017 =
|
104 |
|
105 |
* [Improvement] - Update WP Conditions to 1.0.3
|
2 |
Contributors: sormano
|
3 |
Tags: woocommerce shipping, woocommerce, shipping, woocommerce free shipping, woocommerce free, woocommerce advanced free shipping, wc free shipping, wc shipping, advanced shipping, pro shipping, table rate shipping, country shipping, free shipping
|
4 |
Requires at least: 4.0
|
5 |
+
Tested up to: 4.9
|
6 |
+
Stable tag: 1.1.3
|
7 |
+
Requires PHP: 5.3
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
101 |
|
102 |
== Changelog ==
|
103 |
|
104 |
+
= 1.1.3 - 26-09-2017 =
|
105 |
+
|
106 |
+
* [Add] - Helpful resources meta box
|
107 |
+
* [Tested] - WooCommerce 3.2
|
108 |
+
* [Improvement] - Update WP Conditions to 1.0.5
|
109 |
+
- [Improvement] - WC 3.2 changes to prevent notices
|
110 |
+
= 1.0.4 =
|
111 |
+
- [Improvement] - Use WC_Method:get_method_title() instead of get_title() to get method title.
|
112 |
+
|
113 |
+
|
114 |
= 1.1.2 - 29-06-2017 =
|
115 |
|
116 |
* [Improvement] - Update WP Conditions to 1.0.3
|
woocommerce-advanced-free-shipping.php
CHANGED
@@ -3,10 +3,12 @@
|
|
3 |
* Plugin Name: WooCommerce Advanced Free Shipping
|
4 |
* Plugin URI: https://wordpress.org/plugins/woocommerce-advanced-free-shipping/
|
5 |
* Description: WooCommerce Advanced Free Shipping is an plugin which allows you to set up advanced free shipping conditions.
|
6 |
-
* Version: 1.1.
|
7 |
* Author: Jeroen Sormani
|
8 |
* Author URI: http://jeroensormani.com/
|
9 |
* Text Domain: woocommerce-advanced-free-shipping
|
|
|
|
|
10 |
|
11 |
* Copyright Jeroen Sormani
|
12 |
*
|
@@ -48,7 +50,7 @@ class WooCommerce_Advanced_Free_Shipping {
|
|
48 |
* @since 1.0.4
|
49 |
* @var string $version Plugin version number.
|
50 |
*/
|
51 |
-
public $version = '1.1.
|
52 |
|
53 |
|
54 |
/**
|
@@ -77,16 +79,13 @@ class WooCommerce_Advanced_Free_Shipping {
|
|
77 |
*/
|
78 |
public function __construct() {
|
79 |
|
80 |
-
|
81 |
-
|
|
|
|
|
82 |
}
|
83 |
|
84 |
-
|
85 |
-
if ( ! in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) :
|
86 |
-
if ( ! is_plugin_active_for_network( 'woocommerce/woocommerce.php' ) ) :
|
87 |
-
return;
|
88 |
-
endif;
|
89 |
-
endif;
|
90 |
|
91 |
}
|
92 |
|
@@ -163,7 +162,6 @@ class WooCommerce_Advanced_Free_Shipping {
|
|
163 |
if ( is_admin() ) :
|
164 |
require_once plugin_dir_path( __FILE__ ) . 'includes/admin/class-wafs-admin.php';
|
165 |
$this->admin = new WAFS_Admin();
|
166 |
-
$this->admin->init();
|
167 |
endif;
|
168 |
|
169 |
}
|
@@ -281,7 +279,7 @@ class WooCommerce_Advanced_Free_Shipping {
|
|
281 |
public function php_version_notice() {
|
282 |
|
283 |
?><div class='updated'>
|
284 |
-
|
285 |
</div><?php
|
286 |
|
287 |
}
|
@@ -289,19 +287,19 @@ class WooCommerce_Advanced_Free_Shipping {
|
|
289 |
}
|
290 |
|
291 |
|
292 |
-
/**
|
293 |
-
* The main function responsible for returning the WooCommerce_Advanced_Free_Shipping object.
|
294 |
-
*
|
295 |
-
* Use this function like you would a global variable, except without needing to declare the global.
|
296 |
-
*
|
297 |
-
* Example: <?php WAFS()->method_name(); ?>
|
298 |
-
*
|
299 |
-
* @since 1.1.0
|
300 |
-
*
|
301 |
-
* @return object WooCommerce_Advanced_Free_Shipping class object.
|
302 |
-
*/
|
303 |
if ( ! function_exists( 'WAFS' ) ) :
|
304 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
305 |
function WAFS() {
|
306 |
|
307 |
return WooCommerce_Advanced_Free_Shipping::instance();
|
@@ -311,4 +309,4 @@ if ( ! function_exists( 'WAFS' ) ) :
|
|
311 |
|
312 |
endif;
|
313 |
|
314 |
-
WAFS()
|
3 |
* Plugin Name: WooCommerce Advanced Free Shipping
|
4 |
* Plugin URI: https://wordpress.org/plugins/woocommerce-advanced-free-shipping/
|
5 |
* Description: WooCommerce Advanced Free Shipping is an plugin which allows you to set up advanced free shipping conditions.
|
6 |
+
* Version: 1.1.3
|
7 |
* Author: Jeroen Sormani
|
8 |
* Author URI: http://jeroensormani.com/
|
9 |
* Text Domain: woocommerce-advanced-free-shipping
|
10 |
+
* WC requires at least: 3.0.0
|
11 |
+
* WC tested up to: 3.2.0
|
12 |
|
13 |
* Copyright Jeroen Sormani
|
14 |
*
|
50 |
* @since 1.0.4
|
51 |
* @var string $version Plugin version number.
|
52 |
*/
|
53 |
+
public $version = '1.1.3';
|
54 |
|
55 |
|
56 |
/**
|
79 |
*/
|
80 |
public function __construct() {
|
81 |
|
82 |
+
// Check if WooCommerce is active
|
83 |
+
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
84 |
+
if ( ! is_plugin_active( 'woocommerce/woocommerce.php' ) && ! function_exists( 'WC' ) ) {
|
85 |
+
return;
|
86 |
}
|
87 |
|
88 |
+
$this->init();
|
|
|
|
|
|
|
|
|
|
|
89 |
|
90 |
}
|
91 |
|
162 |
if ( is_admin() ) :
|
163 |
require_once plugin_dir_path( __FILE__ ) . 'includes/admin/class-wafs-admin.php';
|
164 |
$this->admin = new WAFS_Admin();
|
|
|
165 |
endif;
|
166 |
|
167 |
}
|
279 |
public function php_version_notice() {
|
280 |
|
281 |
?><div class='updated'>
|
282 |
+
<p><?php echo sprintf( __( 'Advanced Free Shipping requires PHP 5.3 or higher and your current PHP version is %s. Please (contact your host to) update your PHP version.', 'woocommerce-advanced-messages' ), PHP_VERSION ); ?></p>
|
283 |
</div><?php
|
284 |
|
285 |
}
|
287 |
}
|
288 |
|
289 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
if ( ! function_exists( 'WAFS' ) ) :
|
291 |
|
292 |
+
/**
|
293 |
+
* The main function responsible for returning the WooCommerce_Advanced_Free_Shipping object.
|
294 |
+
*
|
295 |
+
* Use this function like you would a global variable, except without needing to declare the global.
|
296 |
+
*
|
297 |
+
* Example: <?php WAFS()->method_name(); ?>
|
298 |
+
*
|
299 |
+
* @since 1.1.0
|
300 |
+
*
|
301 |
+
* @return object WooCommerce_Advanced_Free_Shipping class object.
|
302 |
+
*/
|
303 |
function WAFS() {
|
304 |
|
305 |
return WooCommerce_Advanced_Free_Shipping::instance();
|
309 |
|
310 |
endif;
|
311 |
|
312 |
+
WAFS();
|