Flexible Shipping for WooCommerce - Version 3.16.3

Version Description

  • 2020-11-30 =
  • Fixed contextual info for DPD UK
  • Changed Author URI
  • Fixed scroll to notice with free shipping message
  • Fixed "Invalid argument supplied for foreach() shipping-method.php on line 210" error
Download this release

Release Info

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

Code changes from version 3.16.2 to 3.16.3

classes/table-rate/shipping-method.php CHANGED
@@ -35,6 +35,10 @@ class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
35
  */
36
  private $message_added = false;
37
 
 
 
 
 
38
 
39
  /**
40
  * Constructor for your shipment class
@@ -199,7 +203,7 @@ class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
199
  }
200
 
201
  public function get_shipping_methods( $enabled = false ) {
202
- $shipping_methods = get_option( $this->shipping_methods_option, array() );
203
  $shipping_method_order = get_option( $this->shipping_method_order_option, array() );
204
  $ret = array();
205
  if ( is_array( $shipping_method_order ) ) {
@@ -219,7 +223,7 @@ class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
219
  }
220
 
221
  public function get_shipping_method_order() {
222
- $shipping_methods = get_option( $this->shipping_methods_option, array() );
223
  $shipping_method_order = get_option( $this->shipping_method_order_option, array() );
224
  $ret = array();
225
  if ( is_array( $shipping_method_order ) ) {
@@ -304,10 +308,10 @@ class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
304
  }
305
  if ( $action == 'new' || $action == 'edit' ) {
306
  $this->add_method_creation_date();
307
- $shipping_methods = get_option( $this->shipping_methods_option, array() );
308
  $shipping_method = array();
309
  if ( $action == 'new' ) {
310
- $shipping_methods = get_option( $this->shipping_methods_option, array() );
311
  $shipping_method_order = get_option( $this->shipping_method_order_option, array() );
312
  //
313
  $method_id = get_option( 'flexible_shipping_method_id', 0 );
@@ -410,7 +414,7 @@ class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
410
  else {
411
  if ( isset( $_POST['import_action'] ) && $_POST['import_action'] == '1' ) {
412
  $tmp_name = $_FILES['import_file']['tmp_name'];
413
- $shipping_methods = get_option( $this->shipping_methods_option, array() );
414
  try {
415
  $importer = new WPDesk_Flexible_Shipping_Csv_Importer( $this );
416
  $shipping_methods = $importer->import( $tmp_name, $shipping_methods );
@@ -475,7 +479,7 @@ class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
475
  <div class="<?php echo esc_html( $settings_div_class ) ; ?>"><table class="form-table">
476
  <?php
477
  if ( $action == 'new' || $action == 'edit' ) {
478
- $shipping_methods = get_option( $this->shipping_methods_option, array() );
479
  $shipping_method = array(
480
  'method_title' => '',
481
  'method_description' => '',
@@ -511,7 +515,7 @@ class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
511
  <?php
512
  if ( isset( $_GET['added'] ) ) {
513
  $method_id = sanitize_key( $_GET['added'] );
514
- $shipping_methods = get_option( $this->shipping_methods_option, array() );
515
  if ( isset( $shipping_methods[$method_id] ) )
516
  {
517
  if ( ! $this->message_added ) {
@@ -530,7 +534,7 @@ class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
530
  if ( isset( $_GET['methods_id'] ) ) {
531
  $methods_id = explode( ',' , sanitize_text_field( $_GET['methods_id'] ) );
532
  }
533
- $shipping_methods = get_option( $this->shipping_methods_option, array() );
534
  $shipping_method_order = get_option( $this->shipping_method_order_option, array() );
535
  foreach ( $methods_id as $method_id ) {
536
  if ( isset( $shipping_methods[$method_id] ) ) {
@@ -553,7 +557,7 @@ class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
553
  else {
554
  if ( isset( $_GET['added'] ) ) {
555
  $method_id = sanitize_key( $_GET['added'] );
556
- $shipping_methods = get_option( $this->shipping_methods_option, array() );
557
  if ( isset( $shipping_methods[$method_id] ) )
558
  {
559
  if ( ! $this->message_added ) {
@@ -566,7 +570,7 @@ class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
566
  }
567
  if ( isset( $_GET['updated'] ) ) {
568
  $method_id = sanitize_key( $_GET['updated'] );
569
- $shipping_methods = get_option( $this->shipping_methods_option, array() );
570
  if ( isset( $shipping_methods[$method_id] ) )
571
  {
572
  $shipping_method = $shipping_methods[$method_id];
@@ -1128,4 +1132,16 @@ class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
1128
  return $subtotal;
1129
  }
1130
 
 
 
 
 
 
 
 
 
 
 
 
 
1131
  }
35
  */
36
  private $message_added = false;
37
 
38
+ /**
39
+ * @var string Option Name
40
+ */
41
+ private $shipping_methods_option;
42
 
43
  /**
44
  * Constructor for your shipment class
203
  }
204
 
205
  public function get_shipping_methods( $enabled = false ) {
206
+ $shipping_methods = $this->get_option_shipping_methods();
207
  $shipping_method_order = get_option( $this->shipping_method_order_option, array() );
208
  $ret = array();
209
  if ( is_array( $shipping_method_order ) ) {
223
  }
224
 
225
  public function get_shipping_method_order() {
226
+ $shipping_methods = $this->get_option_shipping_methods();
227
  $shipping_method_order = get_option( $this->shipping_method_order_option, array() );
228
  $ret = array();
229
  if ( is_array( $shipping_method_order ) ) {
308
  }
309
  if ( $action == 'new' || $action == 'edit' ) {
310
  $this->add_method_creation_date();
311
+ $shipping_methods = $this->get_option_shipping_methods();
312
  $shipping_method = array();
313
  if ( $action == 'new' ) {
314
+ $shipping_methods = $this->get_option_shipping_methods();
315
  $shipping_method_order = get_option( $this->shipping_method_order_option, array() );
316
  //
317
  $method_id = get_option( 'flexible_shipping_method_id', 0 );
414
  else {
415
  if ( isset( $_POST['import_action'] ) && $_POST['import_action'] == '1' ) {
416
  $tmp_name = $_FILES['import_file']['tmp_name'];
417
+ $shipping_methods = $this->get_option_shipping_methods();
418
  try {
419
  $importer = new WPDesk_Flexible_Shipping_Csv_Importer( $this );
420
  $shipping_methods = $importer->import( $tmp_name, $shipping_methods );
479
  <div class="<?php echo esc_html( $settings_div_class ) ; ?>"><table class="form-table">
480
  <?php
481
  if ( $action == 'new' || $action == 'edit' ) {
482
+ $shipping_methods = $this->get_option_shipping_methods();
483
  $shipping_method = array(
484
  'method_title' => '',
485
  'method_description' => '',
515
  <?php
516
  if ( isset( $_GET['added'] ) ) {
517
  $method_id = sanitize_key( $_GET['added'] );
518
+ $shipping_methods = $this->get_option_shipping_methods();
519
  if ( isset( $shipping_methods[$method_id] ) )
520
  {
521
  if ( ! $this->message_added ) {
534
  if ( isset( $_GET['methods_id'] ) ) {
535
  $methods_id = explode( ',' , sanitize_text_field( $_GET['methods_id'] ) );
536
  }
537
+ $shipping_methods = $this->get_option_shipping_methods();
538
  $shipping_method_order = get_option( $this->shipping_method_order_option, array() );
539
  foreach ( $methods_id as $method_id ) {
540
  if ( isset( $shipping_methods[$method_id] ) ) {
557
  else {
558
  if ( isset( $_GET['added'] ) ) {
559
  $method_id = sanitize_key( $_GET['added'] );
560
+ $shipping_methods = $this->get_option_shipping_methods();
561
  if ( isset( $shipping_methods[$method_id] ) )
562
  {
563
  if ( ! $this->message_added ) {
570
  }
571
  if ( isset( $_GET['updated'] ) ) {
572
  $method_id = sanitize_key( $_GET['updated'] );
573
+ $shipping_methods = $this->get_option_shipping_methods();
574
  if ( isset( $shipping_methods[$method_id] ) )
575
  {
576
  $shipping_method = $shipping_methods[$method_id];
1132
  return $subtotal;
1133
  }
1134
 
1135
+ /**
1136
+ * @return array
1137
+ */
1138
+ private function get_option_shipping_methods() {
1139
+ $shipping_methods = get_option( $this->shipping_methods_option, array() );
1140
+
1141
+ if ( ! is_array( $shipping_methods ) ) {
1142
+ $shipping_methods = array();
1143
+ }
1144
+
1145
+ return $shipping_methods;
1146
+ }
1147
  }
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: 3.16.2
7
  * Author: WP Desk
8
- * Author URI: https://www.wpdesk.net/
9
  * Text Domain: flexible-shipping
10
  * Domain Path: /lang/
11
  * Requires at least: 4.9
12
  * Tested up to: 5.5
13
- * WC requires at least: 4.4
14
  * WC tested up to: 4.7
15
  * Requires PHP: 5.6
16
  *
@@ -38,7 +38,7 @@ if ( ! defined( 'ABSPATH' ) ) {
38
  } // Exit if accessed directly
39
 
40
  /* THIS VARIABLE CAN BE CHANGED AUTOMATICALLY */
41
- $plugin_version = '3.16.2';
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: 3.16.3
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
10
  * Domain Path: /lang/
11
  * Requires at least: 4.9
12
  * Tested up to: 5.5
13
+ * WC requires at least: 4.2
14
  * WC tested up to: 4.7
15
  * Requires PHP: 5.6
16
  *
38
  } // Exit if accessed directly
39
 
40
  /* THIS VARIABLE CAN BE CHANGED AUTOMATICALLY */
41
+ $plugin_version = '3.16.3';
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.5
7
- Stable tag: 3.16.2
8
  Requires PHP: 5.6
9
  License: GPLv3 or later
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -163,6 +163,12 @@ If you are upgrading from the old Flexible Shipping version (1.3.2, woo-flexible
163
 
164
  == Changelog ==
165
 
 
 
 
 
 
 
166
  = 3.16.2 - 2020-11-18 =
167
  * Added support for WooCommerce 4.7
168
 
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.5
7
+ Stable tag: 3.16.3
8
  Requires PHP: 5.6
9
  License: GPLv3 or later
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
163
 
164
  == Changelog ==
165
 
166
+ = 3.16.3 - 2020-11-30 =
167
+ * Fixed contextual info for DPD UK
168
+ * Changed Author URI
169
+ * Fixed scroll to notice with free shipping message
170
+ * Fixed "Invalid argument supplied for foreach() shipping-method.php on line 210" error
171
+
172
  = 3.16.2 - 2020-11-18 =
173
  * Added support for WooCommerce 4.7
174
 
src/WPDesk/FS/TableRate/ContextualInfo/Creator.php CHANGED
@@ -78,7 +78,7 @@ class Creator implements HookableCollection {
78
  $phrases_in = array( 'paczkomat', 'paczka w weekend', 'inpost' );
79
  $this->create_inpost_contextual_info( $phrases_in );
80
  $other_phrases_not_in = $this->merge_phrases( $other_phrases_not_in, $phrases_in );
81
- } else {
82
  $phrases_in = array( 'air', 'dpd' );
83
  $this->create_dpd_uk_contextual_info( $phrases_in );
84
  $other_phrases_not_in = $this->merge_phrases( $other_phrases_not_in, $phrases_in );
@@ -105,6 +105,13 @@ class Creator implements HookableCollection {
105
  return 'PL' === $this->base_location_country;
106
  }
107
 
 
 
 
 
 
 
 
108
  /**
109
  * @param array $phrases1 .
110
  * @param array $phrases2 .
@@ -126,7 +133,7 @@ class Creator implements HookableCollection {
126
  'dhl_express',
127
  $phrases_in,
128
  sprintf(
129
- // Translators: link.
130
  __( 'Want to show your customers the DHL Express live rates? %1$sCheck our DHL Express plugin →%2$s', 'flexible-shipping' ),
131
  '<a class="button button-primary" href="https://wpde.sk/fs-up-dhl-express" target="_blank">',
132
  '</a>'
@@ -150,7 +157,7 @@ class Creator implements HookableCollection {
150
  'fedex',
151
  $phrases_in,
152
  sprintf(
153
- // Translators: link.
154
  __( 'Want to show your customers the FedEx live rates? %1$sCheck our FedEx plugin →%2$s', 'flexible-shipping' ),
155
  '<a class="button button-primary" href="' . $target_url . '" target="_blank">',
156
  '</a>'
@@ -174,7 +181,7 @@ class Creator implements HookableCollection {
174
  'ups',
175
  $phrases_in,
176
  sprintf(
177
- // Translators: link.
178
  __( 'Want to show your customers the UPS live rates? %1$sCheck our UPS plugin →%2$s', 'flexible-shipping' ),
179
  '<a class="button button-primary" href="' . $target_url . '" target="_blank">',
180
  '</a>'
@@ -195,7 +202,7 @@ class Creator implements HookableCollection {
195
  'dpd',
196
  $phrases_in,
197
  sprintf(
198
- // Translators: link.
199
  __( 'Sending your products via DPD? Create the shipments and generate shipping labels directly from your shop using our %1$sDPD integration →%2$s', 'flexible-shipping' ),
200
  '<a class="button button-primary" href="https://www.wpdesk.pl/sklep/dpd-woocommerce/?utm_source=flexible-shipping-method-dpd&utm_medium=button&utm_campaign=flexible-shipping-integrations" target="_blank">',
201
  '</a>'
@@ -216,7 +223,7 @@ class Creator implements HookableCollection {
216
  'enadawca',
217
  $phrases_in,
218
  sprintf(
219
- // Translators: link.
220
  __( 'Sending your products via Poczta Polska? Create the shipments and generate shipping labels directly from your shop using our %1$sPoczta Polska eNadawca integration →%2$s', 'flexible-shipping' ),
221
  '<a class="button button-primary" href="https://www.wpdesk.pl/sklep/e-nadawca-poczta-polska-woocommerce/?utm_source=flexible-shipping-method-enadawca&utm_medium=button&utm_campaign=flexible-shipping-integrations" target="_blank">',
222
  '</a>'
@@ -237,7 +244,7 @@ class Creator implements HookableCollection {
237
  'dhl',
238
  $phrases_in,
239
  sprintf(
240
- // Translators: link.
241
  __( 'Sending your products via DHL? Create the shipments and generate shipping labels directly from your shop using our %1$sDHL integration →%2$s', 'flexible-shipping' ),
242
  '<a class="button button-primary" href="https://www.wpdesk.pl/sklep/dhl-woocommerce/?utm_source=flexible-shipping-method-dhl&utm_medium=button&utm_campaign=flexible-shipping-integrations" target="_blank">',
243
  '</a>'
@@ -258,7 +265,7 @@ class Creator implements HookableCollection {
258
  'pwr',
259
  $phrases_in,
260
  sprintf(
261
- // Translators: link.
262
  __( 'Sending your products via Paczka w Ruchu? Create the shipments and generate shipping labels directly from your shop using our %1$sPaczka w Ruchu integration →%2$s', 'flexible-shipping' ),
263
  '<a class="button button-primary" href="https://www.wpdesk.pl/sklep/paczka-w-ruchu-woocommerce/?utm_source=flexible-shipping-method-pwr&utm_medium=button&utm_campaign=flexible-shipping-integrations" target="_blank">',
264
  '</a>'
@@ -279,7 +286,7 @@ class Creator implements HookableCollection {
279
  'inpost',
280
  $phrases_in,
281
  sprintf(
282
- // Translators: link.
283
  __( 'Sending your products via InPost? Create the shipments and generate shipping labels directly from your shop using our %1$sInPost integration →%2$s', 'flexible-shipping' ),
284
  '<a class="button button-primary" href="https://www.wpdesk.pl/sklep/paczkomaty-woocommerce/?utm_source=flexible-shipping-method-inpost&utm_medium=button&utm_campaign=flexible-shipping-integrations" target="_blank">',
285
  '</a>'
@@ -300,7 +307,7 @@ class Creator implements HookableCollection {
300
  'inpost',
301
  $phrases_in,
302
  sprintf(
303
- // Translators: link.
304
  __( 'Sending your products via DPD UK? Create the shipments and generate shipping labels directly from your shop using our %1$sDPD UK integration →%2$s', 'flexible-shipping' ),
305
  '<a class="button button-primary" href="https://flexibleshipping.com/products/dpd-uk-dpd-local-woocommerce/?utm_source=flexible-shipping-method-dpd&utm_medium=button&utm_campaign=flexible-shipping-integrations" target="_blank">',
306
  '</a>'
@@ -331,7 +338,7 @@ class Creator implements HookableCollection {
331
  * @return string
332
  */
333
  private function create_html_for_default_contextual_info() {
334
- if ( 'PL' === $this->base_location_country ) {
335
  return __( 'Check our further shipping integrations with DPD, DHL, InPost, eNadawca and Paczka w Ruchu.', 'flexible-shipping' ) . '&nbsp;&nbsp;' .
336
  sprintf(
337
  // Translators: link.
@@ -339,7 +346,7 @@ class Creator implements HookableCollection {
339
  '<a class="button button-primary" href="https://www.wpdesk.pl/kategoria-produktu/integracje-wysylkowe/?utm_source=flexible-shipping-method&utm_medium=button&utm_campaign=flexible-shipping-integrations" target="_blank">',
340
  ' &rarr;</a>'
341
  );
342
- } else {
343
  return __( 'Check our further shipping integration with DPD UK and FedEx / UPS live rates plugins.', 'flexible-shipping' ) . '&nbsp;&nbsp;' .
344
  sprintf(
345
  // Translators: link.
@@ -347,7 +354,14 @@ class Creator implements HookableCollection {
347
  '<a class="button button-primary" href="https://flexibleshipping.com/product-category/integrations/?utm_source=flexible-shipping-method&utm_medium=button&utm_campaign=flexible-shipping-integrations" target="_blank">',
348
  ' &rarr;</a>'
349
  );
 
 
 
 
 
 
 
 
350
  }
351
  }
352
-
353
  }
78
  $phrases_in = array( 'paczkomat', 'paczka w weekend', 'inpost' );
79
  $this->create_inpost_contextual_info( $phrases_in );
80
  $other_phrases_not_in = $this->merge_phrases( $other_phrases_not_in, $phrases_in );
81
+ } elseif ( $this->is_base_location_country_gb() ) {
82
  $phrases_in = array( 'air', 'dpd' );
83
  $this->create_dpd_uk_contextual_info( $phrases_in );
84
  $other_phrases_not_in = $this->merge_phrases( $other_phrases_not_in, $phrases_in );
105
  return 'PL' === $this->base_location_country;
106
  }
107
 
108
+ /**
109
+ * @return bool
110
+ */
111
+ private function is_base_location_country_gb() {
112
+ return 'GB' === $this->base_location_country;
113
+ }
114
+
115
  /**
116
  * @param array $phrases1 .
117
  * @param array $phrases2 .
133
  'dhl_express',
134
  $phrases_in,
135
  sprintf(
136
+ // Translators: link.
137
  __( 'Want to show your customers the DHL Express live rates? %1$sCheck our DHL Express plugin →%2$s', 'flexible-shipping' ),
138
  '<a class="button button-primary" href="https://wpde.sk/fs-up-dhl-express" target="_blank">',
139
  '</a>'
157
  'fedex',
158
  $phrases_in,
159
  sprintf(
160
+ // Translators: link.
161
  __( 'Want to show your customers the FedEx live rates? %1$sCheck our FedEx plugin →%2$s', 'flexible-shipping' ),
162
  '<a class="button button-primary" href="' . $target_url . '" target="_blank">',
163
  '</a>'
181
  'ups',
182
  $phrases_in,
183
  sprintf(
184
+ // Translators: link.
185
  __( 'Want to show your customers the UPS live rates? %1$sCheck our UPS plugin →%2$s', 'flexible-shipping' ),
186
  '<a class="button button-primary" href="' . $target_url . '" target="_blank">',
187
  '</a>'
202
  'dpd',
203
  $phrases_in,
204
  sprintf(
205
+ // Translators: link.
206
  __( 'Sending your products via DPD? Create the shipments and generate shipping labels directly from your shop using our %1$sDPD integration →%2$s', 'flexible-shipping' ),
207
  '<a class="button button-primary" href="https://www.wpdesk.pl/sklep/dpd-woocommerce/?utm_source=flexible-shipping-method-dpd&utm_medium=button&utm_campaign=flexible-shipping-integrations" target="_blank">',
208
  '</a>'
223
  'enadawca',
224
  $phrases_in,
225
  sprintf(
226
+ // Translators: link.
227
  __( 'Sending your products via Poczta Polska? Create the shipments and generate shipping labels directly from your shop using our %1$sPoczta Polska eNadawca integration →%2$s', 'flexible-shipping' ),
228
  '<a class="button button-primary" href="https://www.wpdesk.pl/sklep/e-nadawca-poczta-polska-woocommerce/?utm_source=flexible-shipping-method-enadawca&utm_medium=button&utm_campaign=flexible-shipping-integrations" target="_blank">',
229
  '</a>'
244
  'dhl',
245
  $phrases_in,
246
  sprintf(
247
+ // Translators: link.
248
  __( 'Sending your products via DHL? Create the shipments and generate shipping labels directly from your shop using our %1$sDHL integration →%2$s', 'flexible-shipping' ),
249
  '<a class="button button-primary" href="https://www.wpdesk.pl/sklep/dhl-woocommerce/?utm_source=flexible-shipping-method-dhl&utm_medium=button&utm_campaign=flexible-shipping-integrations" target="_blank">',
250
  '</a>'
265
  'pwr',
266
  $phrases_in,
267
  sprintf(
268
+ // Translators: link.
269
  __( 'Sending your products via Paczka w Ruchu? Create the shipments and generate shipping labels directly from your shop using our %1$sPaczka w Ruchu integration →%2$s', 'flexible-shipping' ),
270
  '<a class="button button-primary" href="https://www.wpdesk.pl/sklep/paczka-w-ruchu-woocommerce/?utm_source=flexible-shipping-method-pwr&utm_medium=button&utm_campaign=flexible-shipping-integrations" target="_blank">',
271
  '</a>'
286
  'inpost',
287
  $phrases_in,
288
  sprintf(
289
+ // Translators: link.
290
  __( 'Sending your products via InPost? Create the shipments and generate shipping labels directly from your shop using our %1$sInPost integration →%2$s', 'flexible-shipping' ),
291
  '<a class="button button-primary" href="https://www.wpdesk.pl/sklep/paczkomaty-woocommerce/?utm_source=flexible-shipping-method-inpost&utm_medium=button&utm_campaign=flexible-shipping-integrations" target="_blank">',
292
  '</a>'
307
  'inpost',
308
  $phrases_in,
309
  sprintf(
310
+ // Translators: link.
311
  __( 'Sending your products via DPD UK? Create the shipments and generate shipping labels directly from your shop using our %1$sDPD UK integration →%2$s', 'flexible-shipping' ),
312
  '<a class="button button-primary" href="https://flexibleshipping.com/products/dpd-uk-dpd-local-woocommerce/?utm_source=flexible-shipping-method-dpd&utm_medium=button&utm_campaign=flexible-shipping-integrations" target="_blank">',
313
  '</a>'
338
  * @return string
339
  */
340
  private function create_html_for_default_contextual_info() {
341
+ if ( $this->is_base_location_country_pl() ) {
342
  return __( 'Check our further shipping integrations with DPD, DHL, InPost, eNadawca and Paczka w Ruchu.', 'flexible-shipping' ) . '&nbsp;&nbsp;' .
343
  sprintf(
344
  // Translators: link.
346
  '<a class="button button-primary" href="https://www.wpdesk.pl/kategoria-produktu/integracje-wysylkowe/?utm_source=flexible-shipping-method&utm_medium=button&utm_campaign=flexible-shipping-integrations" target="_blank">',
347
  ' &rarr;</a>'
348
  );
349
+ } elseif ( $this->is_base_location_country_gb() ) {
350
  return __( 'Check our further shipping integration with DPD UK and FedEx / UPS live rates plugins.', 'flexible-shipping' ) . '&nbsp;&nbsp;' .
351
  sprintf(
352
  // Translators: link.
354
  '<a class="button button-primary" href="https://flexibleshipping.com/product-category/integrations/?utm_source=flexible-shipping-method&utm_medium=button&utm_campaign=flexible-shipping-integrations" target="_blank">',
355
  ' &rarr;</a>'
356
  );
357
+ } else {
358
+ return __( 'Check our further shipping integration with FedEx / UPS live rates plugins.', 'flexible-shipping' ) . '&nbsp;&nbsp;' .
359
+ sprintf(
360
+ // Translators: link.
361
+ __( '%1$sAdd integration%2$s', 'flexible-shipping' ),
362
+ '<a class="button button-primary" href="https://flexibleshipping.com/product-category/integrations/?utm_source=flexible-shipping-method&utm_medium=button&utm_campaign=flexible-shipping-integrations" target="_blank">',
363
+ ' &rarr;</a>'
364
+ );
365
  }
366
  }
 
367
  }
src/WPDesk/FS/TableRate/FreeShipping/FreeShippingNotice.php CHANGED
@@ -8,6 +8,7 @@
8
  namespace WPDesk\FS\TableRate\FreeShipping;
9
 
10
  use FSVendor\WPDesk\PluginBuilder\Plugin\Hookable;
 
11
 
12
  /**
13
  * Can display free shipping notice.
@@ -18,16 +19,16 @@ class FreeShippingNotice implements Hookable {
18
  const NOTICE_TYPE_SUCCESS = 'success';
19
 
20
  /**
21
- * @var \WC_Session
22
  */
23
  private $session;
24
 
25
  /**
26
  * FreeShippingNotice constructor.
27
  *
28
- * @param \WC_Session $session .
29
  */
30
- public function __construct( \WC_Session $session ) {
31
  $this->session = $session;
32
  }
33
 
@@ -35,36 +36,57 @@ class FreeShippingNotice implements Hookable {
35
  * Hooks.
36
  */
37
  public function hooks() {
38
- add_action( 'wp_head', array( $this, 'add_notice_if_present' ) );
39
- add_action( 'woocommerce_after_calculate_totals', array( $this, 'add_notice_if_present' ) );
 
 
 
 
40
  }
41
 
42
  /**
43
- * Add notice if present.
 
 
 
 
44
  */
45
- public function add_notice_if_present() {
46
- $this->remove_previous_notices_if_added();
47
- if ( is_cart() || is_checkout() || wp_doing_ajax() ) {
48
- $message_text = $this->session->get( FreeShippingNoticeGenerator::SESSION_VARIABLE, '' );
49
- if ( ! empty( $message_text ) ) {
50
- wc_add_notice( $message_text, self::NOTICE_TYPE_SUCCESS, array( self::FLEXIBLE_SHIPPING_FREE_SHIPPING_NOTICE => 'yes' ) );
51
- }
52
  }
 
 
 
 
53
  }
54
 
55
  /**
56
- * Remove previously added notices if present.
57
  */
58
- private function remove_previous_notices_if_added() {
59
- $all_notices = wc_get_notices();
60
- foreach ( $all_notices as $notice_type => $notices_for_type ) {
61
- foreach ( $notices_for_type as $key => $notice ) {
62
- if ( isset( $notice['data'] ) && isset( $notice['data'][ self::FLEXIBLE_SHIPPING_FREE_SHIPPING_NOTICE ] ) ) {
63
- unset( $all_notices[ $notice_type ][ $key ] );
64
- wc_set_notices( $all_notices );
65
- }
66
- }
 
 
 
67
  }
68
  }
69
 
 
 
 
 
 
 
 
 
70
  }
8
  namespace WPDesk\FS\TableRate\FreeShipping;
9
 
10
  use FSVendor\WPDesk\PluginBuilder\Plugin\Hookable;
11
+ use WC_Session;
12
 
13
  /**
14
  * Can display free shipping notice.
19
  const NOTICE_TYPE_SUCCESS = 'success';
20
 
21
  /**
22
+ * @var WC_Session
23
  */
24
  private $session;
25
 
26
  /**
27
  * FreeShippingNotice constructor.
28
  *
29
+ * @param WC_Session $session .
30
  */
31
+ public function __construct( WC_Session $session ) {
32
  $this->session = $session;
33
  }
34
 
36
  * Hooks.
37
  */
38
  public function hooks() {
39
+ // Checkout.
40
+ add_action( 'woocommerce_before_checkout_form', array( $this, 'add_notice_container' ), 20 );
41
+ add_filter( 'woocommerce_update_order_review_fragments', array( $this, 'add_notice_to_fragments' ) );
42
+
43
+ // Cart.
44
+ add_action( 'woocommerce_after_calculate_totals', array( $this, 'add_notice_to_cart' ) );
45
  }
46
 
47
  /**
48
+ * Add notice to fragments.
49
+ *
50
+ * @param array $fragments .
51
+ *
52
+ * @return array
53
  */
54
+ public function add_notice_to_fragments( $fragments ) {
55
+ $message_text = $this->session->get( FreeShippingNoticeGenerator::SESSION_VARIABLE, '' );
56
+
57
+ if ( $message_text ) {
58
+ wc_add_notice( $message_text, self::NOTICE_TYPE_SUCCESS, array( self::FLEXIBLE_SHIPPING_FREE_SHIPPING_NOTICE => 'yes' ) );
 
 
59
  }
60
+
61
+ $fragments['.wpdesk-notice-container'] = $this->print_notice_container( wc_print_notices( true ) );
62
+
63
+ return $fragments;
64
  }
65
 
66
  /**
67
+ * Add empty container for custom notices.
68
  */
69
+ public function add_notice_container() {
70
+ echo $this->print_notice_container(); // WPCS: XSS OK.
71
+ }
72
+
73
+ /**
74
+ * Add notice to cart.
75
+ */
76
+ public function add_notice_to_cart() {
77
+ $message_text = $this->session->get( FreeShippingNoticeGenerator::SESSION_VARIABLE, '' );
78
+
79
+ if ( is_cart() && $message_text ) {
80
+ wc_add_notice( $message_text, self::NOTICE_TYPE_SUCCESS, array( self::FLEXIBLE_SHIPPING_FREE_SHIPPING_NOTICE => 'yes' ) );
81
  }
82
  }
83
 
84
+ /**
85
+ * @param string $message .
86
+ *
87
+ * @return string
88
+ */
89
+ private function print_notice_container( $message = '' ) {
90
+ return '<div class="wpdesk-notice-container">' . wp_kses_post( $message ) . '</div>';
91
+ }
92
  }
src/WPDesk/FS/TableRate/NewRulesTableDeactivationTracker.php CHANGED
@@ -39,7 +39,7 @@ class NewRulesTableDeactivationTracker implements Hookable {
39
  if ( empty( $data[ self::ADDITIONAL_DATA ] ) || ! is_array( $data[ self::ADDITIONAL_DATA ] ) ) {
40
  $data[ self::ADDITIONAL_DATA ] = array();
41
  }
42
- $data[ self::ADDITIONAL_DATA ]['fs_new_rules_table_v3'] = ( new NewRulesTableTrackerData() )->get_data();
43
 
44
  return $data;
45
  }
39
  if ( empty( $data[ self::ADDITIONAL_DATA ] ) || ! is_array( $data[ self::ADDITIONAL_DATA ] ) ) {
40
  $data[ self::ADDITIONAL_DATA ] = array();
41
  }
42
+ $data[ self::ADDITIONAL_DATA ]['fs_new_rules_table_v4'] = ( new NewRulesTableTrackerData() )->get_data();
43
 
44
  return $data;
45
  }
src/WPDesk/FS/TableRate/NewRulesTableTracker.php CHANGED
@@ -36,7 +36,7 @@ class NewRulesTableTracker implements Hookable {
36
  * @return array Updated $data array.
37
  */
38
  public function append_new_rules_table_data_to_tracker( $data ) {
39
- $data['flexible_shipping']['new_rules_table_v3'] = ( new NewRulesTableTrackerData() )->get_data();
40
 
41
  return $data;
42
  }
36
  * @return array Updated $data array.
37
  */
38
  public function append_new_rules_table_data_to_tracker( $data ) {
39
+ $data['flexible_shipping']['new_rules_table_v4'] = ( new NewRulesTableTrackerData() )->get_data();
40
 
41
  return $data;
42
  }
src/WPDesk/FS/TableRate/NewRulesTableTrackerData.php CHANGED
@@ -18,7 +18,7 @@ use WPDesk\FS\TableRate\NewRulesTablePopup\NewRulesPopupClickedOption;
18
  */
19
  class NewRulesTableTrackerData {
20
 
21
- const NEW_USERS_AFTER_THIS_DATE = '2020-10-22 01:00:00';
22
 
23
  /**
24
  * If this a old user? If so then FS should work like always.
18
  */
19
  class NewRulesTableTrackerData {
20
 
21
+ const NEW_USERS_AFTER_THIS_DATE = '2020-12-01 01:00:00';
22
 
23
  /**
24
  * If this a old user? If so then FS should work like always.
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit561f2fb075128c4b54881a73327bf15c::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit8ab3260430d990d9d8127097322a6840::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit561f2fb075128c4b54881a73327bf15c
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit561f2fb075128c4b54881a73327bf15c
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit561f2fb075128c4b54881a73327bf15c', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit561f2fb075128c4b54881a73327bf15c', '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\ComposerStaticInit561f2fb075128c4b54881a73327bf15c::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit8ab3260430d990d9d8127097322a6840
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit8ab3260430d990d9d8127097322a6840', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit8ab3260430d990d9d8127097322a6840', '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\ComposerStaticInit8ab3260430d990d9d8127097322a6840::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit561f2fb075128c4b54881a73327bf15c
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'P' =>
@@ -430,10 +430,10 @@ class ComposerStaticInit561f2fb075128c4b54881a73327bf15c
430
  public static function getInitializer(ClassLoader $loader)
431
  {
432
  return \Closure::bind(function () use ($loader) {
433
- $loader->prefixLengthsPsr4 = ComposerStaticInit561f2fb075128c4b54881a73327bf15c::$prefixLengthsPsr4;
434
- $loader->prefixDirsPsr4 = ComposerStaticInit561f2fb075128c4b54881a73327bf15c::$prefixDirsPsr4;
435
- $loader->fallbackDirsPsr4 = ComposerStaticInit561f2fb075128c4b54881a73327bf15c::$fallbackDirsPsr4;
436
- $loader->classMap = ComposerStaticInit561f2fb075128c4b54881a73327bf15c::$classMap;
437
 
438
  }, null, ClassLoader::class);
439
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit8ab3260430d990d9d8127097322a6840
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'P' =>
430
  public static function getInitializer(ClassLoader $loader)
431
  {
432
  return \Closure::bind(function () use ($loader) {
433
+ $loader->prefixLengthsPsr4 = ComposerStaticInit8ab3260430d990d9d8127097322a6840::$prefixLengthsPsr4;
434
+ $loader->prefixDirsPsr4 = ComposerStaticInit8ab3260430d990d9d8127097322a6840::$prefixDirsPsr4;
435
+ $loader->fallbackDirsPsr4 = ComposerStaticInit8ab3260430d990d9d8127097322a6840::$fallbackDirsPsr4;
436
+ $loader->classMap = ComposerStaticInit8ab3260430d990d9d8127097322a6840::$classMap;
437
 
438
  }, null, ClassLoader::class);
439
  }