Flexible Shipping for WooCommerce - Version 4.4.0

Version Description

  • 2021-04-27 =
  • Added support WooCommerce Subscription with Integrations, ie. WP Desk Inpost Plugin
  • Added support for Currency Switcher for WooCommerce plugin
  • Fixed notice about free shipping when using WPML
  • Fixed integration with Paczka w Ruchu plugin
  • Fixed support for html tags in shipping method description in order details
Download this release

Release Info

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

Code changes from version 4.3.1 to 4.4.0

classes/class-flexible-shipping-plugin.php CHANGED
@@ -29,6 +29,7 @@ use WPDesk\FS\Onboarding\TableRate\Onboarding;
29
  use WPDesk\FS\Onboarding\TableRate\FinishOption;
30
  use WPDesk\FS\Onboarding\TableRate\OptionAjaxUpdater;
31
  use WPDesk\FS\Plugin\PluginActivation;
 
32
  use WPDesk\FS\TableRate\Beacon\Beacon;
33
  use WPDesk\FS\TableRate\Beacon\BeaconClickedAjax;
34
  use WPDesk\FS\TableRate\Beacon\BeaconDeactivationTracker;
@@ -169,7 +170,10 @@ class Flexible_Shipping_Plugin extends AbstractPlugin implements HookableCollect
169
 
170
  $session_factory = new SessionFactory();
171
 
172
- new WPDesk_Flexible_Shipping_Shipment_CPT( $this );
 
 
 
173
 
174
  new WPDesk_Flexible_Shipping_Shipping_Manifest_CPT( $this );
175
 
@@ -179,8 +183,6 @@ class Flexible_Shipping_Plugin extends AbstractPlugin implements HookableCollect
179
 
180
  new WPDesk_Flexible_Shipping_Multilingual( $this );
181
 
182
- new WPDesk_Flexible_Shipping_Multicurrency( $this );
183
-
184
  $this->admin_notices = new WPDesk_Flexible_Shipping_Admin_Notices( $this );
185
 
186
  $this->add_hookable( new WPDesk_Flexible_Shipping_Single_Label_File_Dispatcher() );
@@ -402,9 +404,18 @@ class Flexible_Shipping_Plugin extends AbstractPlugin implements HookableCollect
402
 
403
  add_action( 'woocommerce_init', array( $this, 'init_shipping_zones_notice' ) );
404
 
 
 
405
  $this->hooks_on_hookable_objects();
406
  }
407
 
 
 
 
 
 
 
 
408
  /**
409
  * .
410
  *
@@ -754,7 +765,7 @@ class Flexible_Shipping_Plugin extends AbstractPlugin implements HookableCollect
754
  private function should_enqueue_admin_scripts() {
755
  $current_screen = get_current_screen();
756
  $wc_screen_id = sanitize_title( __( 'WooCommerce', 'woocommerce' ) );
757
- if ( 'shop_order' === $current_screen->post_type || $wc_screen_id . '_page_wc-settings' === $current_screen->id ) {
758
  return true;
759
  }
760
 
29
  use WPDesk\FS\Onboarding\TableRate\FinishOption;
30
  use WPDesk\FS\Onboarding\TableRate\OptionAjaxUpdater;
31
  use WPDesk\FS\Plugin\PluginActivation;
32
+ use WPDesk\FS\Shipment\SubscriptionsIntegration;
33
  use WPDesk\FS\TableRate\Beacon\Beacon;
34
  use WPDesk\FS\TableRate\Beacon\BeaconClickedAjax;
35
  use WPDesk\FS\TableRate\Beacon\BeaconDeactivationTracker;
170
 
171
  $session_factory = new SessionFactory();
172
 
173
+ $shipment_cpt = new WPDesk_Flexible_Shipping_Shipment_CPT( $this );
174
+ $this->add_hookable( $shipment_cpt );
175
+
176
+ $this->add_hookable( new SubscriptionsIntegration( $shipment_cpt ) );
177
 
178
  new WPDesk_Flexible_Shipping_Shipping_Manifest_CPT( $this );
179
 
183
 
184
  new WPDesk_Flexible_Shipping_Multilingual( $this );
185
 
 
 
186
  $this->admin_notices = new WPDesk_Flexible_Shipping_Admin_Notices( $this );
187
 
188
  $this->add_hookable( new WPDesk_Flexible_Shipping_Single_Label_File_Dispatcher() );
404
 
405
  add_action( 'woocommerce_init', array( $this, 'init_shipping_zones_notice' ) );
406
 
407
+ add_action( 'woocommerce_init', array( $this, 'init_multicurrency' ) );
408
+
409
  $this->hooks_on_hookable_objects();
410
  }
411
 
412
+ /**
413
+ * .
414
+ */
415
+ public function init_multicurrency() {
416
+ ( new WPDesk_Flexible_Shipping_Multicurrency() )->hooks();
417
+ }
418
+
419
  /**
420
  * .
421
  *
765
  private function should_enqueue_admin_scripts() {
766
  $current_screen = get_current_screen();
767
  $wc_screen_id = sanitize_title( __( 'WooCommerce', 'woocommerce' ) );
768
+ if ( in_array( $current_screen->post_type, array( 'shop_order', 'shop_subscription' ), true ) || $wc_screen_id . '_page_wc-settings' === $current_screen->id ) {
769
  return true;
770
  }
771
 
classes/table-rate/multicurrency.php CHANGED
@@ -12,25 +12,10 @@ use FSVendor\WPDesk\WooCommerce\CurrencySwitchers\Switcher\WooCommerceMultiCurre
12
  */
13
  class WPDesk_Flexible_Shipping_Multicurrency {
14
 
15
- /**
16
- * @var Flexible_Shipping_Plugin
17
- */
18
- private $plugin;
19
-
20
- /**
21
- * WPDesk_Flexible_Shipping_Multicurrency constructor.
22
- *
23
- * @param Flexible_Shipping_Plugin $plugin .
24
- */
25
- public function __construct( Flexible_Shipping_Plugin $plugin ) {
26
- $this->plugin = $plugin;
27
- $this->hooks();
28
- }
29
-
30
  /**
31
  * @TODO move this functionality to wpdesk/wc-currency-switchers-integrations library.
32
  */
33
- private function hooks() {
34
  add_filter( 'flexible_shipping_value_in_currency', array( $this, 'flexible_shipping_value_in_currency_wpml' ), 1 );
35
 
36
  if ( class_exists( 'Aelia\WC\CurrencySwitcher\WC_Aelia_CurrencySwitcher' ) ) {
@@ -50,6 +35,22 @@ class WPDesk_Flexible_Shipping_Multicurrency {
50
  if ( class_exists( '\WOOMC\Price\Controller' ) ) {
51
  add_filter( 'flexible_shipping_value_in_currency', array( $this, 'flexible_shipping_value_in_currency_woomc' ), 1 );
52
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  }
54
 
55
  /**
12
  */
13
  class WPDesk_Flexible_Shipping_Multicurrency {
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  /**
16
  * @TODO move this functionality to wpdesk/wc-currency-switchers-integrations library.
17
  */
18
+ public function hooks() {
19
  add_filter( 'flexible_shipping_value_in_currency', array( $this, 'flexible_shipping_value_in_currency_wpml' ), 1 );
20
 
21
  if ( class_exists( 'Aelia\WC\CurrencySwitcher\WC_Aelia_CurrencySwitcher' ) ) {
35
  if ( class_exists( '\WOOMC\Price\Controller' ) ) {
36
  add_filter( 'flexible_shipping_value_in_currency', array( $this, 'flexible_shipping_value_in_currency_woomc' ), 1 );
37
  }
38
+
39
+ if ( function_exists( 'alg_wc_cs_get_currency_exchange_rate' ) ) {
40
+ add_filter( 'flexible_shipping_value_in_currency', array( $this, 'flexible_shipping_value_in_currency_alg' ), 1 );
41
+ }
42
+ }
43
+
44
+ /**
45
+ * @param float $value .
46
+ *
47
+ * @return float
48
+ */
49
+ public function flexible_shipping_value_in_currency_alg( $value ) {
50
+ $currency_code = alg_get_current_currency_code();
51
+ $currency_exchange_rate = alg_wc_cs_get_currency_exchange_rate( $currency_code );
52
+
53
+ return $value * $currency_exchange_rate;
54
  }
55
 
56
  /**
classes/wp-wpdesk-fs-shipment/shipment/class-shipment.php CHANGED
@@ -245,6 +245,15 @@ abstract class WPDesk_Flexible_Shipping_Shipment {
245
  return null;
246
  }
247
 
 
 
 
 
 
 
 
 
 
248
  /**
249
  * Loads all meta data from postmeta
250
  */
245
  return null;
246
  }
247
 
248
+ /**
249
+ * @return array
250
+ */
251
+ public function get_meta_data() {
252
+ $this->load_meta_data();
253
+
254
+ return $this->meta_data;
255
+ }
256
+
257
  /**
258
  * Loads all meta data from postmeta
259
  */
classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php CHANGED
@@ -1,223 +1,228 @@
1
  <?php
 
 
 
 
 
2
 
3
- if ( !defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
 
5
- class WPDesk_Flexible_Shipping_Shipment_CPT {
 
 
 
6
 
7
  const POST_TYPE_SHIPMENT = 'shipment';
8
 
9
- private $plugin = null;
10
-
11
  /**
12
  * Is order processed on checkout?
13
  *
14
  * @var bool
15
  */
16
- private $is_order_processed_on_checkout = false;
17
-
18
- public function __construct( Flexible_Shipping_Plugin $plugin ) {
19
- $this->plugin = $plugin;
20
- $this->hooks();
21
- }
22
-
23
- public function hooks() {
24
-
25
- add_action( 'init', array( $this, 'register_post_types' ), 20 );
26
- add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 20, 2 );
27
 
28
- $last_priority = PHP_INT_MAX;
29
-
30
- add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'create_shipping_for_order' ), $last_priority );
 
 
31
 
32
- add_action( 'woocommerce_order_details_after_order_table', array( $this, 'woocommerce_order_details_after_order_table' ) );
 
 
 
 
 
33
 
34
- add_action( 'woocommerce_email_after_order_table', array( $this, 'woocommerce_email_after_order_table' ), 10, 2 );
35
- }
 
 
36
 
37
- /**
38
- * Register post types.
39
- */
40
- public function register_post_types() {
41
 
42
- if ( post_type_exists( self::POST_TYPE_SHIPMENT ) ) {
43
- return;
44
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
- register_post_type( self::POST_TYPE_SHIPMENT,
47
- array(
48
- 'labels' => array(
49
- 'name' => __( 'Shipments', 'flexible-shipping' ),
50
- 'singular_name' => __( 'Shipment', 'flexible-shipping' ),
51
- 'menu_name' => __( 'Shipments', 'flexible-shipping' ),
52
- 'parent_item_colon' => '',
53
- 'all_items' => __( 'Shipments', 'flexible-shipping' ),
54
- 'view_item' => __( 'View Shipments', 'flexible-shipping' ),
55
- 'add_new_item' => __( 'Add new Shipment', 'flexible-shipping' ),
56
- 'add_new' => __( 'Add new Shipment', 'flexible-shipping' ),
57
- 'edit_item' => __( 'Edit Shipment', 'flexible-shipping' ),
58
- 'update_item' => __( 'Save Shipment', 'flexible-shipping' ),
59
- 'search_items' => __( 'Search Shipments', 'flexible-shipping' ),
60
- 'not_found' => __( 'Shipment not found', 'flexible-shipping' ),
61
- 'not_found_in_trash' => __( 'Shipment not found in trash', 'flexible-shipping' )
62
- ),
63
- 'description' => __( 'Shipments.', 'flexible-shipping' ),
64
- 'public' => false,
65
- 'show_ui' => false,
66
- 'capability_type' => 'post',
67
- 'capabilities' => array(),
68
- 'map_meta_cap' => true,
69
- 'publicly_queryable' => false,
70
- 'exclude_from_search' => true,
71
- 'hierarchical' => false,
72
- 'query_var' => true,
73
- 'supports' => array( 'title' ),
74
- 'has_archive' => false,
75
- 'show_in_nav_menus' => true,
76
- 'menu_icon' => 'dashicons-upload',
77
- )
78
- );
 
 
 
 
 
 
 
 
 
 
 
 
79
 
80
- $shipment_statuses = apply_filters( 'flexible_shipping_register_shipment_statuses',
81
- array(
82
- 'fs-new' => array(
83
- 'label' => _x( 'New', 'Shipment status', 'flexible-shipping' ),
84
- 'public' => false,
85
- 'exclude_from_search' => false,
86
- 'show_in_admin_all_list' => true,
87
- 'show_in_admin_status_list' => true,
88
- 'label_count' => _n_noop( 'New <span class="count">(%s)</span>', 'New <span class="count">(%s)</span>', 'flexible-shipping' ),
89
- ),
90
- 'fs-created' => array(
91
- 'label' => _x( 'Created', 'Shipment status', 'flexible-shipping' ),
92
- 'public' => false,
93
- 'exclude_from_search' => false,
94
- 'show_in_admin_all_list' => true,
95
- 'show_in_admin_status_list' => true,
96
- 'label_count' => _n_noop( 'Created <span class="count">(%s)</span>', 'Created <span class="count">(%s)</span>', 'flexible-shipping' ),
97
- ),
98
- 'fs-confirmed' => array(
99
- 'label' => _x( 'Confirmed', 'Shipment status', 'flexible-shipping' ),
100
- 'public' => false,
101
- 'exclude_from_search' => false,
102
- 'show_in_admin_all_list' => true,
103
- 'show_in_admin_status_list' => true,
104
- 'label_count' => _n_noop( 'Confirmed <span class="count">(%s)</span>', 'Confirmed <span class="count">(%s)</span>', 'flexible-shipping' ),
105
- ),
106
- 'fs-manifest' => array(
107
- 'label' => _x( 'Manifest created', 'Shipment status', 'flexible-shipping' ),
108
- 'public' => false,
109
- 'exclude_from_search' => false,
110
- 'show_in_admin_all_list' => true,
111
- 'show_in_admin_status_list' => true,
112
- 'label_count' => _n_noop( 'Confirmed <span class="count">(%s)</span>', 'Confirmed <span class="count">(%s)</span>', 'flexible-shipping' ),
113
- ),
114
- 'fs-failed' => array(
115
- 'label' => _x( 'Failed', 'Shipment status', 'flexible-shipping' ),
116
- 'public' => false,
117
- 'exclude_from_search' => false,
118
- 'show_in_admin_all_list' => true,
119
- 'show_in_admin_status_list' => true,
120
- 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'flexible-shipping' ),
121
- ),
122
- )
123
- );
124
 
125
- foreach ( $shipment_statuses as $shipment_status => $values ) {
126
- register_post_status( $shipment_status, $values );
127
- }
128
 
129
- }
 
 
 
 
 
 
 
 
 
130
 
131
- public function add_meta_boxes( $post_type, $post ) {
132
- if ( $post_type == self::POST_TYPE_SHIPMENT ) {
133
- add_meta_box(
134
- 'shipment_meta_box',
135
- __('Shipment data', 'flexible-shipping'),
136
- array( $this, 'metabox' ),
137
- 'shipment',
138
- 'normal',
139
- 'high'
140
- );
141
- }
142
- if ( $post_type == 'shop_order' ) {
143
- $shipments = fs_get_order_shipments( $post->ID );
144
- foreach ( $shipments as $shipment ) {
145
- $args = array( 'shipment' => $shipment );
146
- add_meta_box(
147
- 'shipment_meta_box_' . $shipment->get_id(),
148
- $shipment->get_order_metabox_title(),
149
- array( $this, 'order_metabox' ),
150
- 'shop_order',
151
- $shipment->get_order_metabox_context(),
152
- 'default',
153
- $args
154
- );
 
 
 
 
155
 
156
- }
157
- }
158
- }
159
 
160
- public function order_metabox( $post, $args ) {
161
- /** @var WPDesk_Flexible_Shipping_Shipment $shipment */
162
- $shipment = $args['args']['shipment'];
163
- $shipment_id = $shipment->get_id();
164
- $message = $shipment->get_error_message();
165
- $message_heading = $shipment->get_order_metabox_title();
166
- $message_css_style = '';
167
- include( 'views/order-metabox.php' );
168
- }
 
 
 
 
169
 
170
- public function metabox() {
171
- global $post;
172
- echo '<pre>';
173
- print_r( $post );
174
- echo '</pre>';
175
- $meta_data = get_post_meta( $post->ID );
176
- foreach ( $meta_data as $key => $val ) {
177
- echo '<pre>';
178
- echo $key;
179
- echo ' = ';
180
- print_r( maybe_unserialize( $val[0] ) );
181
- echo '</pre>';
182
- }
183
- }
 
 
 
184
 
185
  /**
186
  * Get Flexible Shipping method from order shipping method meta data.
187
  *
188
- * @param WC_Order_Item_Shipping $shipping_method
189
  *
190
  * @return array
191
  */
192
- private function get_fs_method_from_order_shipping_method( $shipping_method ) {
193
- $fs_method = array();
194
- if ( version_compare( WC_VERSION, '2.6', '<' ) ) {
195
- if ( isset( $shipping_method['item_meta'] )
196
- && isset( $shipping_method['item_meta']['method_id'] )
197
- && isset( $shipping_method['item_meta']['method_id'][0] )
198
- ) {
199
- $all_shipping_methods = flexible_shipping_get_all_shipping_methods();
200
- $flexible_shipping = $all_shipping_methods['flexible_shipping'];
201
- $flexible_shipping_rates = $flexible_shipping->get_all_rates();
202
- $fs_method = $flexible_shipping_rates[ $shipping_method['item_meta']['method_id'][0] ];
203
- }
204
- }
205
- if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
206
- if ( isset( $shipping_method['item_meta'] )
207
- && isset( $shipping_method['item_meta']['_fs_method'] )
208
- && isset( $shipping_method['item_meta']['_fs_method'][0] )
209
- ) {
210
- $fs_method = unserialize( $shipping_method['item_meta']['_fs_method'][0] );
211
- }
212
- } else {
213
- if ( isset( $shipping_method['item_meta'] )
214
- && isset( $shipping_method['item_meta']['_fs_method'] )
215
- ) {
216
- $fs_method = $shipping_method['item_meta']['_fs_method'];
217
- }
218
- }
219
- return $fs_method;
220
- }
221
 
222
  /**
223
  * Create shipment for order and shipping method.
@@ -231,96 +236,109 @@ class WPDesk_Flexible_Shipping_Shipment_CPT {
231
  *
232
  * @return WPDesk_Flexible_Shipping_Shipment
233
  */
234
- private function create_shipment_for_order_and_fs_shipping_method(
235
  WC_Order $order,
236
- array $fs_method,
237
- $shipping_id,
238
- WC_Order_Item_Shipping $shipping_method,
239
- array $packages,
240
- $package_id
241
- ) {
242
- $shipment = fs_create_shipment( $order, $fs_method );
243
- $shipment->set_meta( '_fs_method', $fs_method );
244
- $shipment->set_meta( '_shipping_id', $shipping_id );
245
- $shipment->set_meta( '_shipping_method', $shipping_method );
246
- $shipment->set_created_via_checkout();
247
- $shipment->checkout( $fs_method, $packages[ $package_id ] );
248
- $shipment->save();
249
- return $shipment;
250
- }
 
251
 
252
  /**
253
  * Create shipping for order.
254
  *
255
- * @param $order_id
256
  */
257
- public function create_shipping_for_order( $order_id ) {
258
- $order = wc_get_order( $order_id );
259
- if ( $order && ! $this->is_order_processed_on_checkout ) {
260
- $mutex = \FSVendor\WPDesk\Mutex\WordpressPostMutex::fromOrder( $order );
261
- $mutex->acquireLock();
262
- $shipments = fs_get_order_shipments( $order_id );
263
- if ( 0 === count( $shipments ) ) {
264
- $this->is_order_processed_on_checkout = true;
265
- $order_shipping_methods = $order->get_shipping_methods();
266
- $packages = WC()->shipping->get_packages();
267
- $package_id = - 1;
268
- global $fs_package_id;
269
- foreach ( $order_shipping_methods as $shipping_id => $shipping_method ) {
270
- $package_id ++;
271
- $fs_package_id = $package_id;
272
- $fs_method = $this->get_fs_method_from_order_shipping_method( $shipping_method );
273
 
274
- if ( ! empty( $fs_method['method_integration'] ) ) {
275
- if ( fs_shipment_integration_exists( $fs_method['method_integration'] ) ) {
276
- $shipment = $this->create_shipment_for_order_and_fs_shipping_method(
277
- $order, $fs_method, $shipping_id, $shipping_method, $packages, $package_id
278
- );
 
 
 
 
 
 
 
 
 
 
 
 
279
 
280
- /**
281
- * Do actions when shipment is created via checkout.
282
- *
283
- * @param WPDesk_Flexible_Shipping_Shipment $shipment Created shipment.
284
- */
285
- do_action( 'flexible_shipping_checkout_shipment_created', $shipment );
286
- }
287
- }
288
- }
289
- }
290
- $mutex->releaseLock();
291
- }
292
- }
 
 
 
 
 
 
 
 
 
 
293
 
294
  /**
295
  * Hook woocommerce_order_details_after_order_table.
296
  *
297
  * @param WC_Abstract_Order $order Order.
298
  */
299
- public function woocommerce_order_details_after_order_table( $order ) {
300
- if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
301
- $order_id = $order->id;
302
- }
303
- else {
304
- $order_id = $order->get_id();
305
- }
306
- $shipments = fs_get_order_shipments( $order_id );
307
- foreach ( $shipments as $shipment ) {
308
- echo $shipment->get_after_order_table();
309
- }
310
- }
311
-
312
- public function woocommerce_email_after_order_table( $order, $sent_to_admin ) {
313
- if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
314
- $order_id = $order->id;
315
- }
316
- else {
317
- $order_id = $order->get_id();
318
- }
319
- $shipments = fs_get_order_shipments( $order_id );
320
- foreach ( $shipments as $shipment ) {
321
- echo $shipment->get_email_after_order_table();
322
- }
323
- }
324
 
 
 
 
 
 
 
 
 
 
 
 
325
 
326
  }
1
  <?php
2
+ /**
3
+ * Class WPDesk_Flexible_Shipping_Shipment_CPT
4
+ *
5
+ * @package Flexible Shipping
6
+ */
7
 
8
+ use FSVendor\WPDesk\PluginBuilder\Plugin\Hookable;
9
 
10
+ /**
11
+ * Shipment Custom Post Type.
12
+ */
13
+ class WPDesk_Flexible_Shipping_Shipment_CPT implements Hookable {
14
 
15
  const POST_TYPE_SHIPMENT = 'shipment';
16
 
 
 
17
  /**
18
  * Is order processed on checkout?
19
  *
20
  * @var bool
21
  */
22
+ private $is_order_processed_on_checkout = false;
 
 
 
 
 
 
 
 
 
 
23
 
24
+ /**
25
+ * Hooks.
26
+ */
27
+ public function hooks() {
28
+ $last_priority = PHP_INT_MAX;
29
 
30
+ add_action( 'init', array( $this, 'register_post_types' ), 20 );
31
+ add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 20, 2 );
32
+ add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'create_shipping_for_order' ), $last_priority );
33
+ add_action( 'woocommerce_order_details_after_order_table', array( $this, 'woocommerce_order_details_after_order_table' ) );
34
+ add_action( 'woocommerce_email_after_order_table', array( $this, 'woocommerce_email_after_order_table' ), 10, 2 );
35
+ }
36
 
37
+ /**
38
+ * Register post types.
39
+ */
40
+ public function register_post_types() {
41
 
42
+ if ( post_type_exists( self::POST_TYPE_SHIPMENT ) ) {
43
+ return;
44
+ }
 
45
 
46
+ register_post_type(
47
+ self::POST_TYPE_SHIPMENT,
48
+ array(
49
+ 'labels' => array(
50
+ 'name' => __( 'Shipments', 'flexible-shipping' ),
51
+ 'singular_name' => __( 'Shipment', 'flexible-shipping' ),
52
+ 'menu_name' => __( 'Shipments', 'flexible-shipping' ),
53
+ 'parent_item_colon' => '',
54
+ 'all_items' => __( 'Shipments', 'flexible-shipping' ),
55
+ 'view_item' => __( 'View Shipments', 'flexible-shipping' ),
56
+ 'add_new_item' => __( 'Add new Shipment', 'flexible-shipping' ),
57
+ 'add_new' => __( 'Add new Shipment', 'flexible-shipping' ),
58
+ 'edit_item' => __( 'Edit Shipment', 'flexible-shipping' ),
59
+ 'update_item' => __( 'Save Shipment', 'flexible-shipping' ),
60
+ 'search_items' => __( 'Search Shipments', 'flexible-shipping' ),
61
+ 'not_found' => __( 'Shipment not found', 'flexible-shipping' ),
62
+ 'not_found_in_trash' => __( 'Shipment not found in trash', 'flexible-shipping' ),
63
+ ),
64
+ 'description' => __( 'Shipments.', 'flexible-shipping' ),
65
+ 'public' => false,
66
+ 'show_ui' => false,
67
+ 'capability_type' => 'post',
68
+ 'capabilities' => array(),
69
+ 'map_meta_cap' => true,
70
+ 'publicly_queryable' => false,
71
+ 'exclude_from_search' => true,
72
+ 'hierarchical' => false,
73
+ 'query_var' => true,
74
+ 'supports' => array( 'title' ),
75
+ 'has_archive' => false,
76
+ 'show_in_nav_menus' => true,
77
+ 'menu_icon' => 'dashicons-upload',
78
+ )
79
+ );
80
 
81
+ $shipment_statuses = apply_filters(
82
+ 'flexible_shipping_register_shipment_statuses',
83
+ array(
84
+ 'fs-new' => array(
85
+ 'label' => _x( 'New', 'Shipment status', 'flexible-shipping' ),
86
+ 'public' => false,
87
+ 'exclude_from_search' => false,
88
+ 'show_in_admin_all_list' => true,
89
+ 'show_in_admin_status_list' => true,
90
+ 'label_count' => _n_noop( 'New <span class="count">(%s)</span>', 'New <span class="count">(%s)</span>', 'flexible-shipping' ), // phpcs:ignore.
91
+ ),
92
+ 'fs-created' => array(
93
+ 'label' => _x( 'Created', 'Shipment status', 'flexible-shipping' ),
94
+ 'public' => false,
95
+ 'exclude_from_search' => false,
96
+ 'show_in_admin_all_list' => true,
97
+ 'show_in_admin_status_list' => true,
98
+ 'label_count' => _n_noop( 'Created <span class="count">(%s)</span>', 'Created <span class="count">(%s)</span>', 'flexible-shipping' ), // phpcs:ignore.
99
+ ),
100
+ 'fs-confirmed' => array(
101
+ 'label' => _x( 'Confirmed', 'Shipment status', 'flexible-shipping' ),
102
+ 'public' => false,
103
+ 'exclude_from_search' => false,
104
+ 'show_in_admin_all_list' => true,
105
+ 'show_in_admin_status_list' => true,
106
+ 'label_count' => _n_noop( 'Confirmed <span class="count">(%s)</span>', 'Confirmed <span class="count">(%s)</span>', 'flexible-shipping' ), // phpcs:ignore.
107
+ ),
108
+ 'fs-manifest' => array(
109
+ 'label' => _x( 'Manifest created', 'Shipment status', 'flexible-shipping' ),
110
+ 'public' => false,
111
+ 'exclude_from_search' => false,
112
+ 'show_in_admin_all_list' => true,
113
+ 'show_in_admin_status_list' => true,
114
+ 'label_count' => _n_noop( 'Confirmed <span class="count">(%s)</span>', 'Confirmed <span class="count">(%s)</span>', 'flexible-shipping' ), // phpcs:ignore.
115
+ ),
116
+ 'fs-failed' => array(
117
+ 'label' => _x( 'Failed', 'Shipment status', 'flexible-shipping' ),
118
+ 'public' => false,
119
+ 'exclude_from_search' => false,
120
+ 'show_in_admin_all_list' => true,
121
+ 'show_in_admin_status_list' => true,
122
+ 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'flexible-shipping' ), // phpcs:ignore.
123
+ ),
124
+ )
125
+ );
126
 
127
+ foreach ( $shipment_statuses as $shipment_status => $values ) {
128
+ register_post_status( $shipment_status, $values );
129
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
 
131
+ }
 
 
132
 
133
+ /**
134
+ * Prepares class name for integration.
135
+ *
136
+ * @param string $integration .
137
+ *
138
+ * @return string
139
+ */
140
+ public function prepare_integration_class_name( $integration ) {
141
+ return apply_filters( 'flexible_shipping_shipment_class', 'WPDesk_Flexible_Shipping_Shipment_' . $integration, $integration );
142
+ }
143
 
144
+ /**
145
+ * @param string $post_type .
146
+ * @param WP_Post $post .
147
+ */
148
+ public function add_meta_boxes( $post_type, $post ) {
149
+ if ( self::POST_TYPE_SHIPMENT === $post_type ) {
150
+ add_meta_box(
151
+ 'shipment_meta_box',
152
+ __( 'Shipment data', 'flexible-shipping' ),
153
+ array( $this, 'metabox' ),
154
+ 'shipment',
155
+ 'normal',
156
+ 'high'
157
+ );
158
+ }
159
+ if ( in_array( $post_type, array( 'shop_order', 'shop_subscription' ), true ) ) {
160
+ $shipments = fs_get_order_shipments( $post->ID );
161
+ foreach ( $shipments as $shipment ) {
162
+ $args = array( 'shipment' => $shipment );
163
+ add_meta_box(
164
+ 'shipment_meta_box_' . $shipment->get_id(),
165
+ $shipment->get_order_metabox_title(),
166
+ array( $this, 'order_metabox' ),
167
+ null,
168
+ $shipment->get_order_metabox_context(),
169
+ 'default',
170
+ $args
171
+ );
172
 
173
+ }
174
+ }
175
+ }
176
 
177
+ /**
178
+ * @param WP_Post $post .
179
+ * @param array $args .
180
+ */
181
+ public function order_metabox( $post, $args ) {
182
+ /** @var WPDesk_Flexible_Shipping_Shipment $shipment */
183
+ $shipment = $args['args']['shipment'];
184
+ $shipment_id = $shipment->get_id();
185
+ $message = $shipment->get_error_message();
186
+ $message_heading = $shipment->get_order_metabox_title();
187
+ $message_css_style = '';
188
+ include( 'views/order-metabox.php' );
189
+ }
190
 
191
+ /**
192
+ * .
193
+ */
194
+ public function metabox() {
195
+ global $post;
196
+ echo '<pre>';
197
+ print_r( $post );
198
+ echo '</pre>';
199
+ $meta_data = get_post_meta( $post->ID );
200
+ foreach ( $meta_data as $key => $val ) {
201
+ echo '<pre>';
202
+ echo esc_html( $key );
203
+ echo ' = ';
204
+ print_r( maybe_unserialize( $val[0] ) );
205
+ echo '</pre>';
206
+ }
207
+ }
208
 
209
  /**
210
  * Get Flexible Shipping method from order shipping method meta data.
211
  *
212
+ * @param WC_Order_Item_Shipping $shipping_method .
213
  *
214
  * @return array
215
  */
216
+ private function get_fs_method_from_order_shipping_method( $shipping_method ) {
217
+ $fs_method = array();
218
+ if ( isset( $shipping_method['item_meta'] )
219
+ && isset( $shipping_method['item_meta']['_fs_method'] )
220
+ ) {
221
+ $fs_method = $shipping_method['item_meta']['_fs_method'];
222
+ }
223
+
224
+ return $fs_method;
225
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
 
227
  /**
228
  * Create shipment for order and shipping method.
236
  *
237
  * @return WPDesk_Flexible_Shipping_Shipment
238
  */
239
+ private function create_shipment_for_order_and_fs_shipping_method(
240
  WC_Order $order,
241
+ array $fs_method,
242
+ $shipping_id,
243
+ WC_Order_Item_Shipping $shipping_method,
244
+ array $packages,
245
+ $package_id
246
+ ) {
247
+ $shipment = fs_create_shipment( $order, $fs_method );
248
+ $shipment->set_meta( '_fs_method', $fs_method );
249
+ $shipment->set_meta( '_shipping_id', $shipping_id );
250
+ $shipment->set_meta( '_shipping_method', $shipping_method );
251
+ $shipment->set_created_via_checkout();
252
+ $shipment->checkout( $fs_method, $packages[ $package_id ] );
253
+ $shipment->save();
254
+
255
+ return $shipment;
256
+ }
257
 
258
  /**
259
  * Create shipping for order.
260
  *
261
+ * @param int $order_id .
262
  */
263
+ public function create_shipping_for_order( $order_id ) {
264
+ $order = wc_get_order( $order_id );
265
+ if ( $order && ! $this->is_order_processed_on_checkout ) {
266
+ $mutex = \FSVendor\WPDesk\Mutex\WordpressPostMutex::fromOrder( $order );
267
+ $mutex->acquireLock();
268
+ $shipments = fs_get_order_shipments( $order_id );
269
+ if ( 0 === count( $shipments ) ) {
270
+ $this->is_order_processed_on_checkout = true;
271
+ $this->create_shipping_for_order_and_cart( $order, WC()->cart );
272
+ }
273
+ $mutex->releaseLock();
274
+ }
275
+ }
 
 
 
276
 
277
+ /**
278
+ * @param WC_Order $order .
279
+ * @param WC_Cart $cart .
280
+ */
281
+ public function create_shipping_for_order_and_cart( $order, $cart ) {
282
+ global $fs_package_id;
283
+ $order_shipping_methods = $order->get_shipping_methods();
284
+ $packages = $cart->get_shipping_packages();
285
+ $package_id = - 1;
286
+ foreach ( $order_shipping_methods as $shipping_id => $shipping_method ) {
287
+ $package_id ++;
288
+ $fs_package_id = $package_id;
289
+ $fs_method = $this->get_fs_method_from_order_shipping_method( $shipping_method );
290
+ if ( ! empty( $fs_method['method_integration'] ) ) {
291
+ $integration = $fs_method['method_integration'];
292
+ if ( fs_shipment_integration_exists( $integration ) && $this->is_order_type_supported_by_integration( $order->get_type(), $integration ) ) {
293
+ $shipment = $this->create_shipment_for_order_and_fs_shipping_method( $order, $fs_method, $shipping_id, $shipping_method, $packages, $package_id );
294
 
295
+ /**
296
+ * Do actions when shipment is created via checkout.
297
+ *
298
+ * @param WPDesk_Flexible_Shipping_Shipment $shipment Created shipment.
299
+ */
300
+ do_action( 'flexible_shipping_checkout_shipment_created', $shipment );
301
+ }
302
+ }
303
+ }
304
+ }
305
+
306
+ /**
307
+ * @param string $order_type .
308
+ * @param string $integration .
309
+ *
310
+ * @return bool
311
+ */
312
+ private function is_order_type_supported_by_integration( $order_type, $integration ) {
313
+ $supported = 'shop_order' === $order_type;
314
+ $supported = apply_filters( 'flexible-shipping/shipment/supported-order-type/' . $integration, $supported, $order_type );
315
+
316
+ return is_bool( $supported ) ? $supported : false;
317
+ }
318
 
319
  /**
320
  * Hook woocommerce_order_details_after_order_table.
321
  *
322
  * @param WC_Abstract_Order $order Order.
323
  */
324
+ public function woocommerce_order_details_after_order_table( $order ) {
325
+ $order_id = $order->get_id();
326
+ $shipments = fs_get_order_shipments( $order_id );
327
+ foreach ( $shipments as $shipment ) {
328
+ echo wp_kses_post( $shipment->get_after_order_table() );
329
+ }
330
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
 
332
+ /**
333
+ * @param WC_Order $order .
334
+ * @param bool $sent_to_admin .
335
+ */
336
+ public function woocommerce_email_after_order_table( $order, $sent_to_admin ) {
337
+ $order_id = $order->get_id();
338
+ $shipments = fs_get_order_shipments( $order_id );
339
+ foreach ( $shipments as $shipment ) {
340
+ echo wp_kses_post( $shipment->get_email_after_order_table() );
341
+ }
342
+ }
343
 
344
  }
classes/wp-wpdesk-fs-shipment/shipment/functions.php CHANGED
@@ -1,14 +1,45 @@
1
  <?php
 
 
 
 
 
2
 
3
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
-
 
 
 
 
 
 
5
 
 
 
 
 
 
6
  function fs_shipment_integration_exists( $integration ) {
7
- $class_name = apply_filters( 'flexible_shipping_shipment_class', 'WPDesk_Flexible_Shipping_Shipment' . '_' . $integration, $integration );
8
- if ( class_exists( $class_name ) ) {
9
- return true;
10
- }
11
- return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  }
13
 
14
  /**
@@ -18,59 +49,62 @@ function fs_shipment_integration_exists( $integration ) {
18
  * @return WPDesk_Flexible_Shipping_Shipment
19
  */
20
  function fs_create_shipment( $order, $fs_method ) {
21
- if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
22
- $order_id = $order->id;
23
- }
24
- else {
25
- $order_id = $order->get_id();
26
- }
27
- $integration = $fs_method['method_integration'];
28
- $post_title = sprintf( __( 'Shipment for order %s, %s', 'flexible-shipping' ), $order_id, $integration );
29
- $post_title = apply_filters( 'flexible_shipping_shipment_post_title_'. $integration, $post_title, $fs_method );
30
- $shipment_post = array(
31
- 'post_title' => $post_title,
32
- 'post_type' => 'shipment',
33
- 'post_status' => 'fs-new',
34
- 'post_parent' => $order_id
35
- );
36
- $shipment_id = wp_insert_post( $shipment_post );
37
- update_post_meta( $shipment_id, '_integration', $integration );
38
- return fs_get_shipment( $shipment_id, $order );
 
39
  }
40
 
41
  /**
42
  * Returns shipments for order.
43
  * Shipments are ordered from oldest to newest.
44
  *
45
- * @param $order_id
46
- * @param string|null $integration
47
- * @return WPDesk_Flexible_Shipping_Shipment_Interface[]
 
48
  */
49
  function fs_get_order_shipments( $order_id, $integration = null ) {
50
- $shipments_posts_query = array(
51
- 'posts_per_page' => -1,
52
- 'post_parent' => $order_id,
53
- 'post_type' => 'shipment',
54
- 'post_status' => 'any',
55
- 'orderby' => 'ID',
56
- 'order' => 'ASC',
57
- );
58
- if ( !empty( $integration ) ) {
59
- $shipments_posts_query['meta_key'] = '_integration';
60
- $shipments_posts_query['meta_value'] = $integration;
61
- }
62
- $shipments_posts = get_posts( $shipments_posts_query );
63
- $shipments = array();
64
- if ( count( $shipments_posts ) ) {
65
- $order = wc_get_order($order_id);
66
- foreach ($shipments_posts as $shipment_post) {
67
- $integration = get_post_meta($shipment_post->ID, '_integration', true);
68
- if ( fs_shipment_integration_exists( $integration ) ) {
69
- $shipments[] = fs_get_shipment($shipment_post->ID, $order);
70
- }
71
- }
72
- }
73
- return $shipments;
 
74
  }
75
 
76
  /**
@@ -78,17 +112,18 @@ function fs_get_order_shipments( $order_id, $integration = null ) {
78
  *
79
  * @param int $shipment_id Shipment id.
80
  * @param WC_Order|null $order Order.
 
81
  * @return WPDesk_Flexible_Shipping_Shipment
82
  */
83
  function fs_get_shipment( $shipment_id, $order = null ) {
84
- $integration = get_post_meta( $shipment_id, '_integration', true );
85
- $class_name = 'WPDesk_Flexible_Shipping_Shipment';
86
- $integration_class_name = 'WPDesk_Flexible_Shipping_Shipment' . '_' . $integration;
87
- $integration_class_name = apply_filters( 'flexible_shipping_shipment_class', $integration_class_name, $integration );
88
  if ( class_exists( $integration_class_name ) ) {
89
  $class_name = $integration_class_name;
90
  }
91
- return new $class_name( $shipment_id, $order );
 
92
  }
93
 
94
  /**
@@ -97,30 +132,32 @@ function fs_get_shipment( $shipment_id, $order = null ) {
97
  * @return float
98
  */
99
  function fs_calculate_order_weight( $order ) {
100
- $weight = 0;
101
- if ( sizeof( $order->get_items() ) > 0 ) {
102
- foreach( $order->get_items() as $item ) {
103
- if ( $item['product_id'] > 0 ) {
104
- if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
105
- $product = $order->get_product_from_item( $item );
106
- }
107
- else {
108
- $product = $item->get_product();
109
- }
110
- $product_weight = $product->get_weight();
111
- if ( ! $product->is_virtual() && is_numeric( $product_weight ) ) {
112
- $weight += floatval( $product->get_weight() ) * floatval( $item['qty'] );
113
- }
114
- }
115
- }
116
- }
117
- return $weight;
118
  }
119
 
 
 
 
 
 
120
  function fs_calculate_package_weight( $package ) {
121
- $weight = 0;
122
- foreach( $package['contents'] as $item ) {
123
- $weight += floatval( $item['data']->get_weight() ) * floatval( $item['quantity'] );
124
- }
125
- return $weight;
 
126
  }
1
  <?php
2
+ /**
3
+ * Shipments functions.
4
+ *
5
+ * @package Flexible Shipping
6
+ */
7
 
8
+ /**
9
+ * @param string $integration .
10
+ *
11
+ * @return string
12
+ */
13
+ function fs_shipment_integration_class( $integration ) {
14
+ return apply_filters( 'flexible_shipping_shipment_class', 'WPDesk_Flexible_Shipping_Shipment_' . $integration, $integration );
15
+ }
16
 
17
+ /**
18
+ * @param string $integration .
19
+ *
20
+ * @return bool
21
+ */
22
  function fs_shipment_integration_exists( $integration ) {
23
+ return class_exists( fs_shipment_integration_class( $integration ) );
24
+ }
25
+
26
+ /**
27
+ * @param string $integration .
28
+ * @param string $order_type .
29
+ *
30
+ * @return false
31
+ */
32
+ function fs_integration_supports_order_type( $integration, $order_type ) {
33
+ $supports = true;
34
+ if ( 'shop_subscription' === $order_type ) {
35
+ $supports = false;
36
+ $class_name = fs_shipment_integration_class( $integration );
37
+ if ( class_exists( $class_name ) ) {
38
+ $supports = $class_name::is_subscriptions_supported();
39
+ }
40
+ }
41
+
42
+ return $supports;
43
  }
44
 
45
  /**
49
  * @return WPDesk_Flexible_Shipping_Shipment
50
  */
51
  function fs_create_shipment( $order, $fs_method ) {
52
+ if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
53
+ $order_id = $order->id;
54
+ } else {
55
+ $order_id = $order->get_id();
56
+ }
57
+ $integration = $fs_method['method_integration'];
58
+ // Translators: order id and integration.
59
+ $post_title = sprintf( __( 'Shipment for order %s, %s', 'flexible-shipping' ), $order_id, $integration ); // phpcs:ignore.
60
+ $post_title = apply_filters( 'flexible_shipping_shipment_post_title_' . $integration, $post_title, $fs_method );
61
+ $shipment_post = array(
62
+ 'post_title' => $post_title,
63
+ 'post_type' => 'shipment',
64
+ 'post_status' => 'fs-new',
65
+ 'post_parent' => $order_id,
66
+ );
67
+ $shipment_id = wp_insert_post( $shipment_post );
68
+ update_post_meta( $shipment_id, '_integration', $integration );
69
+
70
+ return fs_get_shipment( $shipment_id, $order );
71
  }
72
 
73
  /**
74
  * Returns shipments for order.
75
  * Shipments are ordered from oldest to newest.
76
  *
77
+ * @param int $order_id .
78
+ * @param string|null $integration .
79
+ *
80
+ * @return WPDesk_Flexible_Shipping_Shipment[]
81
  */
82
  function fs_get_order_shipments( $order_id, $integration = null ) {
83
+ $shipments_posts_query = array(
84
+ 'nopaging' => true,
85
+ 'post_parent' => $order_id,
86
+ 'post_type' => 'shipment',
87
+ 'post_status' => 'any',
88
+ 'orderby' => 'ID',
89
+ 'order' => 'ASC',
90
+ );
91
+ if ( ! empty( $integration ) ) {
92
+ $shipments_posts_query['meta_key'] = '_integration';
93
+ $shipments_posts_query['meta_value'] = $integration;
94
+ }
95
+ $shipments_posts = get_posts( $shipments_posts_query );
96
+ $shipments = array();
97
+ if ( count( $shipments_posts ) ) {
98
+ $order = wc_get_order( $order_id );
99
+ foreach ( $shipments_posts as $shipment_post ) {
100
+ $integration = get_post_meta( $shipment_post->ID, '_integration', true );
101
+ if ( fs_shipment_integration_exists( $integration ) ) {
102
+ $shipments[] = fs_get_shipment( $shipment_post->ID, $order );
103
+ }
104
+ }
105
+ }
106
+
107
+ return $shipments;
108
  }
109
 
110
  /**
112
  *
113
  * @param int $shipment_id Shipment id.
114
  * @param WC_Order|null $order Order.
115
+ *
116
  * @return WPDesk_Flexible_Shipping_Shipment
117
  */
118
  function fs_get_shipment( $shipment_id, $order = null ) {
119
+ $integration = get_post_meta( $shipment_id, '_integration', true );
120
+ $class_name = 'WPDesk_Flexible_Shipping_Shipment';
121
+ $integration_class_name = fs_shipment_integration_class( $integration );
 
122
  if ( class_exists( $integration_class_name ) ) {
123
  $class_name = $integration_class_name;
124
  }
125
+
126
+ return new $class_name( $shipment_id, $order );
127
  }
128
 
129
  /**
132
  * @return float
133
  */
134
  function fs_calculate_order_weight( $order ) {
135
+ $weight = 0;
136
+ if ( count( $order->get_items() ) > 0 ) {
137
+ foreach ( $order->get_items() as $item ) {
138
+ if ( $item['product_id'] > 0 ) {
139
+ $product = $item->get_product();
140
+ $product_weight = $product->get_weight();
141
+ if ( ! $product->is_virtual() && is_numeric( $product_weight ) ) {
142
+ $weight += floatval( $product->get_weight() ) * floatval( $item['qty'] );
143
+ }
144
+ }
145
+ }
146
+ }
147
+
148
+ return $weight;
 
 
 
 
149
  }
150
 
151
+ /**
152
+ * @param array $package .
153
+ *
154
+ * @return float|int
155
+ */
156
  function fs_calculate_package_weight( $package ) {
157
+ $weight = 0;
158
+ foreach ( $package['contents'] as $item ) {
159
+ $weight += floatval( $item['data']->get_weight() ) * floatval( $item['quantity'] );
160
+ }
161
+
162
+ return $weight;
163
  }
classes/wp-wpdesk-fs-shipment/shipment/interface-shipment.php CHANGED
@@ -1,76 +1,101 @@
1
  <?php
 
 
 
 
 
2
 
3
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
 
 
 
4
 
5
- if ( ! interface_exists( 'WPDesk_Flexible_Shipping_Shipment_Interface' ) ) {
 
 
 
 
 
 
6
 
7
- interface WPDesk_Flexible_Shipping_Shipment_Interface {
 
 
 
 
8
 
9
- /**
10
- * @param array $fs_method
11
- * @param array $package
12
- * @return void
13
- * Executes on woocommerce checkout when order is created
14
- */
15
- public function checkout( array $fs_method, $package );
16
 
17
- /**
18
- * @return void
19
- * Displays metabox in woocommerce order
20
- */
21
- public function order_metabox();
 
 
 
22
 
23
- /**
24
- * @return string
25
- * Returns woocommerce metabox title
26
- */
27
- public function get_order_metabox_title();
 
28
 
29
- /**
30
- * @param string $action
31
- * @param array $data
32
- * @return void
33
- * Executes on ajax request. $data contains all woocommerce order metabox fields values from metabox generated in order_metabox() method.
34
- */
35
- public function ajax_request( $action, $data );
36
 
37
- /**
38
- * @return string
39
- * Returns error message
40
- */
41
- public function get_error_message();
 
 
 
42
 
43
- /**
44
- * @return string
45
- * Returns tracking number for shipment
46
- */
47
- public function get_tracking_number();
48
 
49
- /**
50
- * @return string
51
- * Returns tracking URL for shipping
52
- */
53
- public function get_tracking_url();
54
 
55
- /**
56
- * @return array
57
- * Return label data foe shipping in array:
58
- * 'label_format' => 'pdf'
59
- * 'content' => pdf content,
60
- * 'file_name' => file name for label
61
- */
62
- public function get_label();
63
 
64
- /**
65
- * @return mixed
66
- */
67
- public function get_after_order_table();
 
 
 
 
68
 
69
- /**
70
- * @return mixed
71
- */
72
- public function get_email_after_order_table();
73
 
74
- }
 
 
 
75
 
76
  }
1
  <?php
2
+ /**
3
+ * Interface WPDesk_Flexible_Shipping_Shipment_Interface
4
+ *
5
+ * @package Flexible Shipping
6
+ */
7
 
8
+ /**
9
+ * Shipping.
10
+ */
11
+ interface WPDesk_Flexible_Shipping_Shipment_Interface {
12
 
13
+ /**
14
+ * @param string $meta_key .
15
+ * @param null|string $default .
16
+ *
17
+ * @return array|string|null
18
+ */
19
+ public function get_meta( $meta_key = '', $default = null );
20
 
21
+ /**
22
+ * @param string $meta_key .
23
+ * @param int|string|array|object|null $value .
24
+ */
25
+ public function set_meta( $meta_key, $value );
26
 
27
+ /**
28
+ * @return array
29
+ */
30
+ public function get_meta_data();
 
 
 
31
 
32
+ /**
33
+ * @param array $fs_method .
34
+ * @param array $package .
35
+ *
36
+ * @return void
37
+ * Executes on woocommerce checkout when order is created
38
+ */
39
+ public function checkout( array $fs_method, $package );
40
 
41
+ /**
42
+ * Displays metabox in woocommerce order.
43
+ *
44
+ * @return void
45
+ */
46
+ public function order_metabox();
47
 
48
+ /**
49
+ * Returns woocommerce metabox title.
50
+ *
51
+ * @return string
52
+ */
53
+ public function get_order_metabox_title();
 
54
 
55
+ /**
56
+ * @param string $action .
57
+ * @param array $data .
58
+ *
59
+ * @return void
60
+ * Executes on ajax request. $data contains all woocommerce order metabox fields values from metabox generated in order_metabox() method.
61
+ */
62
+ public function ajax_request( $action, $data );
63
 
64
+ /**
65
+ * @return string
66
+ * Returns error message
67
+ */
68
+ public function get_error_message();
69
 
70
+ /**
71
+ * @return string
72
+ * Returns tracking number for shipment
73
+ */
74
+ public function get_tracking_number();
75
 
76
+ /**
77
+ * @return string
78
+ * Returns tracking URL for shipping
79
+ */
80
+ public function get_tracking_url();
 
 
 
81
 
82
+ /**
83
+ * @return array
84
+ * Return label data foe shipping in array:
85
+ * 'label_format' => 'pdf'
86
+ * 'content' => pdf content,
87
+ * 'file_name' => file name for label
88
+ */
89
+ public function get_label();
90
 
91
+ /**
92
+ * @return mixed
93
+ */
94
+ public function get_after_order_table();
95
 
96
+ /**
97
+ * @return mixed
98
+ */
99
+ public function get_email_after_order_table();
100
 
101
  }
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: 4.3.1
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
@@ -38,7 +38,7 @@ if ( ! defined( 'ABSPATH' ) ) {
38
  } // Exit if accessed directly
39
 
40
  /* THIS VARIABLE CAN BE CHANGED AUTOMATICALLY */
41
- $plugin_version = '4.3.1';
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.4.0
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
38
  } // Exit if accessed directly
39
 
40
  /* THIS VARIABLE CAN BE CHANGED AUTOMATICALLY */
41
+ $plugin_version = '4.4.0';
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.3.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-04-20T14:45:50+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"
@@ -44,24 +44,24 @@ msgid "https://flexibleshipping.com/?utm_source=plugin-list&utm_medium=link&utm_
44
  msgstr ""
45
 
46
  #. Translators: link.
47
- #: classes/class-flexible-shipping-plugin.php:710
48
  msgid "How can We make Flexible Shipping better for you? %1$sJust write to us.%2$s"
49
  msgstr ""
50
 
51
- #: classes/class-flexible-shipping-plugin.php:787
52
  #: vendor_prefixed/wpdesk/wp-wpdesk-helper/src/Page/SettingsPage.php:46
53
  msgid "Settings"
54
  msgstr ""
55
 
56
- #: classes/class-flexible-shipping-plugin.php:791
57
  msgid "Docs"
58
  msgstr ""
59
 
60
- #: classes/class-flexible-shipping-plugin.php:792
61
  msgid "Support"
62
  msgstr ""
63
 
64
- #: classes/class-flexible-shipping-plugin.php:798
65
  msgid "Upgrade"
66
  msgstr ""
67
 
@@ -717,9 +717,9 @@ msgid "Shipping Manifests."
717
  msgstr ""
718
 
719
  #: classes/wp-wpdesk-fs-shipment/manifest/cpt-shipping-manifest.php:116
720
- #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:49
721
- #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:51
722
- #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:53
723
  msgid "Shipments"
724
  msgstr ""
725
 
@@ -754,7 +754,7 @@ msgstr ""
754
 
755
  #: classes/wp-wpdesk-fs-shipment/manifest/views/manifest-metabox.php:7
756
  #: classes/wp-wpdesk-fs-shipment/manifest/views/manifest-metabox.php:47
757
- #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:50
758
  #: templates/email/after_order_table.php:12
759
  #: templates/myaccount/after_order_table.php:15
760
  msgid "Shipment"
@@ -804,98 +804,99 @@ msgstr ""
804
  msgid "Awesome, you've been using Flexible Shipping for more than 2 weeks. Could you please do me a BIG favor and give it a 5-star rating on WordPress? ~FS Team"
805
  msgstr ""
806
 
807
- #: classes/wp-wpdesk-fs-shipment/shipment/class-shipment.php:378
808
  msgid "Please override shipping_column method!"
809
  msgstr ""
810
 
811
- #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:54
812
  msgid "View Shipments"
813
  msgstr ""
814
 
815
- #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:55
816
  #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:56
 
817
  msgid "Add new Shipment"
818
  msgstr ""
819
 
820
- #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:57
821
  msgid "Edit Shipment"
822
  msgstr ""
823
 
824
- #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:58
825
  msgid "Save Shipment"
826
  msgstr ""
827
 
828
- #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:59
829
  msgid "Search Shipments"
830
  msgstr ""
831
 
832
- #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:60
833
  msgid "Shipment not found"
834
  msgstr ""
835
 
836
- #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:61
837
  msgid "Shipment not found in trash"
838
  msgstr ""
839
 
840
- #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:63
841
  msgid "Shipments."
842
  msgstr ""
843
 
844
- #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:83
845
  msgctxt "Shipment status"
846
  msgid "New"
847
  msgstr ""
848
 
849
- #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:88
850
  msgid "New <span class=\"count\">(%s)</span>"
851
  msgid_plural "New <span class=\"count\">(%s)</span>"
852
  msgstr[0] ""
853
  msgstr[1] ""
854
 
855
- #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:91
856
  msgctxt "Shipment status"
857
  msgid "Created"
858
  msgstr ""
859
 
860
- #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:96
861
  msgid "Created <span class=\"count\">(%s)</span>"
862
  msgid_plural "Created <span class=\"count\">(%s)</span>"
863
  msgstr[0] ""
864
  msgstr[1] ""
865
 
866
- #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:99
867
  msgctxt "Shipment status"
868
  msgid "Confirmed"
869
  msgstr ""
870
 
871
- #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:104
872
- #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:112
873
  msgid "Confirmed <span class=\"count\">(%s)</span>"
874
  msgid_plural "Confirmed <span class=\"count\">(%s)</span>"
875
  msgstr[0] ""
876
  msgstr[1] ""
877
 
878
- #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:107
879
  msgctxt "Shipment status"
880
  msgid "Manifest created"
881
  msgstr ""
882
 
883
- #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:115
884
  msgctxt "Shipment status"
885
  msgid "Failed"
886
  msgstr ""
887
 
888
- #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:120
889
  msgid "Failed <span class=\"count\">(%s)</span>"
890
  msgid_plural "Failed <span class=\"count\">(%s)</span>"
891
  msgstr[0] ""
892
  msgstr[1] ""
893
 
894
- #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:135
895
  msgid "Shipment data"
896
  msgstr ""
897
 
898
- #: classes/wp-wpdesk-fs-shipment/shipment/functions.php:28
 
899
  msgid "Shipment for order %s, %s"
900
  msgstr ""
901
 
@@ -1499,7 +1500,7 @@ msgid "special action"
1499
  msgstr ""
1500
 
1501
  #: src/WPDesk/FS/TableRate/ShippingMethod/CommonMethodSettings.php:34
1502
- #: src/WPDesk/FS/TableRate/ShippingMethod/RateCalculator.php:335
1503
  msgid "Free"
1504
  msgstr ""
1505
 
@@ -1597,26 +1598,22 @@ msgstr ""
1597
  msgid "Advanced Options"
1598
  msgstr ""
1599
 
1600
- #: src/WPDesk/FS/TableRate/ShippingMethod/Convert/ConvertNotice.php:65
1601
- msgid "The possibility to edit the Flexible Shipping <strong>Group Methods</strong> will be disabled from 1st May, 2021. It's highly advised to convert them to their single version up to this date."
1602
- msgstr ""
1603
-
1604
  #. Translators: URL.
1605
- #: src/WPDesk/FS/TableRate/ShippingMethod/Convert/ConvertNotice.php:76
1606
  msgid "Flexible Shipping group method you are currently viewing has been converted to its new single version and deactivated for safety reasons. Once you make sure everything was converted properly, you can safely delete this group method. If you notice any discrepancies please %1$srun the conversion process once again%2$s.%3$sIf you use any custom functions or plugins targeting the specific shipping methods based on their IDs, e.g. %4$sFlexible Checkout Fields PRO%5$s, %6$sActive Payments%7$s, %8$sShopMagic%9$s or similar, please re-check their configuration in order to maintain their proper functioning after the conversion."
1607
  msgstr ""
1608
 
1609
  #. Translators: URL.
1610
- #: src/WPDesk/FS/TableRate/ShippingMethod/Convert/ConvertNotice.php:100
1611
- msgid "Flexible Shipping group method is no longer supported. It is highly recommended to convert it to the new version. %1$sStart converting%2$s or %3$slearn more about it &rarr;%4$s.%5$sPlease mind that if you use any custom functions or plugins targeting the specific shipping methods based on their IDs, e.g. %6$sFlexible Checkout Fields PRO%7$s, %8$sActive Payments%9$s, %10$sShopMagic%11$s or similar, you may need to reconfigure them after the conversion to remain their proper functioning."
1612
  msgstr ""
1613
 
1614
  #. Translators: URL.
1615
- #: src/WPDesk/FS/TableRate/ShippingMethod/Convert/ConvertNotice.php:120
1616
  msgid "Flexible Shipping group method is no longer supported. %1$sLearn more about it &rarr;%2$s."
1617
  msgstr ""
1618
 
1619
- #: src/WPDesk/FS/TableRate/ShippingMethod/Convert/ConvertNotice.php:176
1620
  msgid "Flexible Shipping group method has been converted to its new single version and deactivated for safety reasons. Once you make sure everything was converted properly, you can safely delete the previous group method."
1621
  msgstr ""
1622
 
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.4.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-04-27T07:56:05+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"
44
  msgstr ""
45
 
46
  #. Translators: link.
47
+ #: classes/class-flexible-shipping-plugin.php:721
48
  msgid "How can We make Flexible Shipping better for you? %1$sJust write to us.%2$s"
49
  msgstr ""
50
 
51
+ #: classes/class-flexible-shipping-plugin.php:798
52
  #: vendor_prefixed/wpdesk/wp-wpdesk-helper/src/Page/SettingsPage.php:46
53
  msgid "Settings"
54
  msgstr ""
55
 
56
+ #: classes/class-flexible-shipping-plugin.php:802
57
  msgid "Docs"
58
  msgstr ""
59
 
60
+ #: classes/class-flexible-shipping-plugin.php:803
61
  msgid "Support"
62
  msgstr ""
63
 
64
+ #: classes/class-flexible-shipping-plugin.php:809
65
  msgid "Upgrade"
66
  msgstr ""
67
 
717
  msgstr ""
718
 
719
  #: classes/wp-wpdesk-fs-shipment/manifest/cpt-shipping-manifest.php:116
720
+ #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:50
721
+ #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:52
722
+ #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:54
723
  msgid "Shipments"
724
  msgstr ""
725
 
754
 
755
  #: classes/wp-wpdesk-fs-shipment/manifest/views/manifest-metabox.php:7
756
  #: classes/wp-wpdesk-fs-shipment/manifest/views/manifest-metabox.php:47
757
+ #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:51
758
  #: templates/email/after_order_table.php:12
759
  #: templates/myaccount/after_order_table.php:15
760
  msgid "Shipment"
804
  msgid "Awesome, you've been using Flexible Shipping for more than 2 weeks. Could you please do me a BIG favor and give it a 5-star rating on WordPress? ~FS Team"
805
  msgstr ""
806
 
807
+ #: classes/wp-wpdesk-fs-shipment/shipment/class-shipment.php:387
808
  msgid "Please override shipping_column method!"
809
  msgstr ""
810
 
811
+ #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:55
812
  msgid "View Shipments"
813
  msgstr ""
814
 
 
815
  #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:56
816
+ #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:57
817
  msgid "Add new Shipment"
818
  msgstr ""
819
 
820
+ #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:58
821
  msgid "Edit Shipment"
822
  msgstr ""
823
 
824
+ #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:59
825
  msgid "Save Shipment"
826
  msgstr ""
827
 
828
+ #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:60
829
  msgid "Search Shipments"
830
  msgstr ""
831
 
832
+ #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:61
833
  msgid "Shipment not found"
834
  msgstr ""
835
 
836
+ #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:62
837
  msgid "Shipment not found in trash"
838
  msgstr ""
839
 
840
+ #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:64
841
  msgid "Shipments."
842
  msgstr ""
843
 
844
+ #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:85
845
  msgctxt "Shipment status"
846
  msgid "New"
847
  msgstr ""
848
 
849
+ #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:90
850
  msgid "New <span class=\"count\">(%s)</span>"
851
  msgid_plural "New <span class=\"count\">(%s)</span>"
852
  msgstr[0] ""
853
  msgstr[1] ""
854
 
855
+ #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:93
856
  msgctxt "Shipment status"
857
  msgid "Created"
858
  msgstr ""
859
 
860
+ #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:98
861
  msgid "Created <span class=\"count\">(%s)</span>"
862
  msgid_plural "Created <span class=\"count\">(%s)</span>"
863
  msgstr[0] ""
864
  msgstr[1] ""
865
 
866
+ #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:101
867
  msgctxt "Shipment status"
868
  msgid "Confirmed"
869
  msgstr ""
870
 
871
+ #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:106
872
+ #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:114
873
  msgid "Confirmed <span class=\"count\">(%s)</span>"
874
  msgid_plural "Confirmed <span class=\"count\">(%s)</span>"
875
  msgstr[0] ""
876
  msgstr[1] ""
877
 
878
+ #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:109
879
  msgctxt "Shipment status"
880
  msgid "Manifest created"
881
  msgstr ""
882
 
883
+ #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:117
884
  msgctxt "Shipment status"
885
  msgid "Failed"
886
  msgstr ""
887
 
888
+ #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:122
889
  msgid "Failed <span class=\"count\">(%s)</span>"
890
  msgid_plural "Failed <span class=\"count\">(%s)</span>"
891
  msgstr[0] ""
892
  msgstr[1] ""
893
 
894
+ #: classes/wp-wpdesk-fs-shipment/shipment/cpt-shipment.php:152
895
  msgid "Shipment data"
896
  msgstr ""
897
 
898
+ #. Translators: order id and integration.
899
+ #: classes/wp-wpdesk-fs-shipment/shipment/functions.php:59
900
  msgid "Shipment for order %s, %s"
901
  msgstr ""
902
 
1500
  msgstr ""
1501
 
1502
  #: src/WPDesk/FS/TableRate/ShippingMethod/CommonMethodSettings.php:34
1503
+ #: src/WPDesk/FS/TableRate/ShippingMethod/RateCalculator.php:338
1504
  msgid "Free"
1505
  msgstr ""
1506
 
1598
  msgid "Advanced Options"
1599
  msgstr ""
1600
 
 
 
 
 
1601
  #. Translators: URL.
1602
+ #: src/WPDesk/FS/TableRate/ShippingMethod/Convert/ConvertNotice.php:70
1603
  msgid "Flexible Shipping group method you are currently viewing has been converted to its new single version and deactivated for safety reasons. Once you make sure everything was converted properly, you can safely delete this group method. If you notice any discrepancies please %1$srun the conversion process once again%2$s.%3$sIf you use any custom functions or plugins targeting the specific shipping methods based on their IDs, e.g. %4$sFlexible Checkout Fields PRO%5$s, %6$sActive Payments%7$s, %8$sShopMagic%9$s or similar, please re-check their configuration in order to maintain their proper functioning after the conversion."
1604
  msgstr ""
1605
 
1606
  #. Translators: URL.
1607
+ #: src/WPDesk/FS/TableRate/ShippingMethod/Convert/ConvertNotice.php:94
1608
+ msgid "Flexible Shipping group methods are no longer supported. Despite the fact that they still remain editable, no other new features are going to be added to them. It is highly recommended to convert them to the supported single ones. %1$sStart converting%2$s or %3$slearn more about it &rarr;%4$s.%5$sPlease mind that if you use any custom functions or plugins targeting the specific shipping methods based on their IDs, e.g. %6$sFlexible Checkout Fields PRO%7$s, %8$sActive Payments%9$s, %10$sShopMagic%11$s or similar, you may need to reconfigure them after the conversion to remain their proper functioning."
1609
  msgstr ""
1610
 
1611
  #. Translators: URL.
1612
+ #: src/WPDesk/FS/TableRate/ShippingMethod/Convert/ConvertNotice.php:114
1613
  msgid "Flexible Shipping group method is no longer supported. %1$sLearn more about it &rarr;%2$s."
1614
  msgstr ""
1615
 
1616
+ #: src/WPDesk/FS/TableRate/ShippingMethod/Convert/ConvertNotice.php:170
1617
  msgid "Flexible Shipping group method has been converted to its new single version and deactivated for safety reasons. Once you make sure everything was converted properly, you can safely delete the previous group method."
1618
  msgstr ""
1619
 
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, 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.7
7
- Stable tag: 4.3.1
8
  Requires PHP: 7.0
9
  License: GPLv3 or later
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -183,6 +183,13 @@ If you are upgrading from the old Flexible Shipping version (1.3.2, woo-flexible
183
 
184
  == Changelog ==
185
 
 
 
 
 
 
 
 
186
  = 4.3.1 - 2021-04-20 =
187
  * Added support for html tags in shipping method description
188
  * Fixed invalid default label for autocomplete fields
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.7
7
+ Stable tag: 4.4.0
8
  Requires PHP: 7.0
9
  License: GPLv3 or later
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
183
 
184
  == Changelog ==
185
 
186
+ = 4.4.0 - 2021-04-27 =
187
+ * Added support WooCommerce Subscription with Integrations, ie. WP Desk Inpost Plugin
188
+ * Added support for Currency Switcher for WooCommerce plugin
189
+ * Fixed notice about free shipping when using WPML
190
+ * Fixed integration with Paczka w Ruchu plugin
191
+ * Fixed support for html tags in shipping method description in order details
192
+
193
  = 4.3.1 - 2021-04-20 =
194
  * Added support for html tags in shipping method description
195
  * Fixed invalid default label for autocomplete fields
src/WPDesk/FS/Shipment/SubscriptionsIntegration.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class SubscriptionsIntegration
4
+ *
5
+ * @package WPDesk\FS\Shipment
6
+ */
7
+
8
+ namespace WPDesk\FS\Shipment;
9
+
10
+ use FSVendor\WPDesk\PluginBuilder\Plugin\Hookable;
11
+
12
+ /**
13
+ * Integrates Shipments with WooCommerce Subscriptions plugin.
14
+ */
15
+ class SubscriptionsIntegration implements Hookable {
16
+
17
+ /**
18
+ * @var \WPDesk_Flexible_Shipping_Shipment_CPT
19
+ */
20
+ private $shipment_cpt;
21
+
22
+ /**
23
+ * SubscriptionsIntegration constructor.
24
+ *
25
+ * @param \WPDesk_Flexible_Shipping_Shipment_CPT $shipment_cpt .
26
+ */
27
+ public function __construct( \WPDesk_Flexible_Shipping_Shipment_CPT $shipment_cpt ) {
28
+ $this->shipment_cpt = $shipment_cpt;
29
+ }
30
+
31
+ /**
32
+ * .
33
+ */
34
+ public function hooks() {
35
+ $last_priority = PHP_INT_MAX;
36
+ add_action( 'woocommerce_checkout_subscription_created', array( $this, 'create_shipping_for_subscription' ), $last_priority, 3 );
37
+ add_filter( 'wcs_renewal_order_created', array( $this, 'create_shipping_for_order_from_subscription' ), 10, 2 );
38
+ }
39
+
40
+ /**
41
+ * @param \WC_Subscription $subscription .
42
+ * @param \WC_Order $order .
43
+ * @param \WC_Cart $recurring_cart .
44
+ */
45
+ public function create_shipping_for_subscription( $subscription, $order, $recurring_cart ) {
46
+ $this->shipment_cpt->create_shipping_for_order_and_cart( $subscription, $recurring_cart );
47
+ }
48
+
49
+ /**
50
+ * @param \WC_Order $order .
51
+ * @param \WC_Subscription $subscription .
52
+ */
53
+ public function create_shipping_for_order_from_subscription( $order, $subscription ) {
54
+ $subscription_shipments = fs_get_order_shipments( $subscription->get_id() );
55
+ foreach ( $subscription_shipments as $shipment ) {
56
+ $this->create_single_shipment( $shipment, $order );
57
+ }
58
+
59
+ return $order;
60
+ }
61
+
62
+ /**
63
+ * @param \WPDesk_Flexible_Shipping_Shipment $shipment .
64
+ * @param \WC_Order $order .
65
+ */
66
+ private function create_single_shipment( \WPDesk_Flexible_Shipping_Shipment $shipment, \WC_Order $order ) {
67
+ $meta_data = $shipment->get_meta_data();
68
+ $fs_method = $shipment->get_meta( '_fs_method', array( 'method_integration' => $shipment->get_integration() ) );
69
+ $order_shipment = fs_create_shipment( $order, $fs_method );
70
+ $integration = $order_shipment->get_integration();
71
+ $this->setup_shipment_meta_data( $meta_data, $integration, $shipment, $order_shipment );
72
+ $order_shipment->save();
73
+
74
+ /**
75
+ * New shipment created from subscription.
76
+ *
77
+ * @param WPDesk_Flexible_Shipping_Shipment $order_shipment Created shipment.
78
+ */
79
+ do_action( 'flexible-shipping/shipment-from-subscription/created/' . $integration, $order_shipment );
80
+ }
81
+
82
+ /**
83
+ * @param array $meta_data .
84
+ * @param string $integration .
85
+ * @param \WPDesk_Flexible_Shipping_Shipment $shipment .
86
+ * @param \WPDesk_Flexible_Shipping_Shipment $order_shipment .
87
+ */
88
+ private function setup_shipment_meta_data( array $meta_data, $integration, \WPDesk_Flexible_Shipping_Shipment $shipment, \WPDesk_Flexible_Shipping_Shipment $order_shipment ) {
89
+ foreach ( $meta_data as $meta_key => $meta_value ) {
90
+ $order_shipment_meta_value =
91
+ apply_filters( 'flexible-shipping/shipment-from-subscription/meta-value/' . $integration, $shipment->get_meta( $meta_key ), $meta_key, $order_shipment );
92
+ $order_shipment->set_meta( $meta_key, $order_shipment_meta_value );
93
+ }
94
+ }
95
+
96
+
97
+ }
src/WPDesk/FS/TableRate/FreeShipping/FreeShippingNotice.php CHANGED
@@ -59,12 +59,12 @@ class FreeShippingNotice implements Hookable {
59
  * Add notice to free shipping left.
60
  */
61
  public function add_notice_free_shipping() {
62
- remove_action( 'woocommerce_after_calculate_totals', array( $this, 'add_notice_free_shipping' ) );
63
-
64
  $message_text = $this->session->get( FreeShippingNoticeGenerator::SESSION_VARIABLE, '' );
65
 
66
  if ( $this->should_add_to_card( $message_text ) || $this->should_add_to_checkout( $message_text ) ) {
67
  wc_add_notice( $message_text, self::NOTICE_TYPE_SUCCESS, array( self::FLEXIBLE_SHIPPING_FREE_SHIPPING_NOTICE => 'yes' ) );
 
 
68
  }
69
  }
70
 
59
  * Add notice to free shipping left.
60
  */
61
  public function add_notice_free_shipping() {
 
 
62
  $message_text = $this->session->get( FreeShippingNoticeGenerator::SESSION_VARIABLE, '' );
63
 
64
  if ( $this->should_add_to_card( $message_text ) || $this->should_add_to_checkout( $message_text ) ) {
65
  wc_add_notice( $message_text, self::NOTICE_TYPE_SUCCESS, array( self::FLEXIBLE_SHIPPING_FREE_SHIPPING_NOTICE => 'yes' ) );
66
+
67
+ remove_action( 'woocommerce_after_calculate_totals', array( $this, 'add_notice_free_shipping' ) );
68
  }
69
  }
70
 
src/WPDesk/FS/TableRate/Order/ItemMeta.php CHANGED
@@ -70,6 +70,7 @@ class ItemMeta implements Hookable {
70
  */
71
  public function hide_flexible_shipping_item_meta( $hidden_order_item_meta ) {
72
  $hidden_order_item_meta[] = RateCalculator::FS_INTEGRATION;
 
73
 
74
  return $hidden_order_item_meta;
75
  }
70
  */
71
  public function hide_flexible_shipping_item_meta( $hidden_order_item_meta ) {
72
  $hidden_order_item_meta[] = RateCalculator::FS_INTEGRATION;
73
+ $hidden_order_item_meta[] = RateCalculator::DESCRIPTION_BASE64ENCODED;
74
 
75
  return $hidden_order_item_meta;
76
  }
src/WPDesk/FS/TableRate/Rates/FlexibleShippingRates.php CHANGED
@@ -90,10 +90,11 @@ class FlexibleShippingRates {
90
  * @return array
91
  */
92
  private static function append_flexible_shipping_single_rate( array $rates, ShippingMethodSingle $woo_shipping_method ) {
93
- $shipping_method = $woo_shipping_method->instance_settings;
94
- $shipping_method['instance_id'] = $woo_shipping_method->instance_id;
95
- $rates[ $woo_shipping_method->get_rate_id() ] = $shipping_method;
96
- $rates[ $woo_shipping_method->get_rate_id() ]['method_id'] = ShippingMethodSingle::SHIPPING_METHOD_ID;
 
97
 
98
  return $rates;
99
  }
90
  * @return array
91
  */
92
  private static function append_flexible_shipping_single_rate( array $rates, ShippingMethodSingle $woo_shipping_method ) {
93
+ $shipping_method = $woo_shipping_method->instance_settings;
94
+ $shipping_method['instance_id'] = $woo_shipping_method->instance_id;
95
+ $rates[ $woo_shipping_method->get_rate_id() ] = $shipping_method;
96
+ $rates[ $woo_shipping_method->get_rate_id() ]['method_id'] = ShippingMethodSingle::SHIPPING_METHOD_ID;
97
+ $rates[ $woo_shipping_method->get_rate_id() ]['method_enabled'] = $woo_shipping_method->enabled;
98
 
99
  return $rates;
100
  }
src/WPDesk/FS/TableRate/ShippingMethod/Convert/ConvertNotice.php CHANGED
@@ -61,12 +61,6 @@ class ConvertNotice implements Hookable {
61
 
62
  $is_limited_notice_width = $this->is_limited_notice_width();
63
 
64
- $this->add_notice(
65
- __( 'The possibility to edit the Flexible Shipping <strong>Group Methods</strong> will be disabled from 1st May, 2021. It\'s highly advised to convert them to their single version up to this date.', 'flexible-shipping' ),
66
- 'warning',
67
- $is_limited_notice_width
68
- );
69
-
70
  if ( $shipping_method->is_converted() ) {
71
  $convert_url = add_query_arg( 'converting_again', 'true', $convert_url );
72
 
@@ -97,7 +91,7 @@ class ConvertNotice implements Hookable {
97
  $this->add_notice(
98
  sprintf(
99
  // Translators: URL.
100
- __( 'Flexible Shipping group method is no longer supported. It is highly recommended to convert it to the new version. %1$sStart converting%2$s or %3$slearn more about it &rarr;%4$s.%5$sPlease mind that if you use any custom functions or plugins targeting the specific shipping methods based on their IDs, e.g. %6$sFlexible Checkout Fields PRO%7$s, %8$sActive Payments%9$s, %10$sShopMagic%11$s or similar, you may need to reconfigure them after the conversion to remain their proper functioning.', 'flexible-shipping' ),
101
  '<a href="' . esc_url( $convert_url ) . '">',
102
  '</a>',
103
  '<a href="' . esc_url( $learn_more_url ) . '" target="_blank">',
61
 
62
  $is_limited_notice_width = $this->is_limited_notice_width();
63
 
 
 
 
 
 
 
64
  if ( $shipping_method->is_converted() ) {
65
  $convert_url = add_query_arg( 'converting_again', 'true', $convert_url );
66
 
91
  $this->add_notice(
92
  sprintf(
93
  // Translators: URL.
94
+ __( 'Flexible Shipping group methods are no longer supported. Despite the fact that they still remain editable, no other new features are going to be added to them. It is highly recommended to convert them to the supported single ones. %1$sStart converting%2$s or %3$slearn more about it &rarr;%4$s.%5$sPlease mind that if you use any custom functions or plugins targeting the specific shipping methods based on their IDs, e.g. %6$sFlexible Checkout Fields PRO%7$s, %8$sActive Payments%9$s, %10$sShopMagic%11$s or similar, you may need to reconfigure them after the conversion to remain their proper functioning.', 'flexible-shipping' ),
95
  '<a href="' . esc_url( $convert_url ) . '">',
96
  '</a>',
97
  '<a href="' . esc_url( $learn_more_url ) . '" target="_blank">',
src/WPDesk/FS/TableRate/ShippingMethod/RateCalculator.php CHANGED
@@ -306,10 +306,13 @@ class RateCalculator {
306
  WPDesk_Flexible_Shipping::META_DEFAULT => $method_settings->get_default(),
307
  self::FS_METHOD => $method_settings->get_raw_settings(),
308
  self::FS_INTEGRATION => $method_settings->get_integration(),
309
- self::DESCRIPTION => wpdesk__( $method_settings->get_description(), 'flexible-shipping' ),
310
- self::DESCRIPTION_BASE64ENCODED => base64_encode( $description ),
311
  );
312
 
 
 
 
 
313
  /**
314
  * Rate metadata.
315
  *
306
  WPDesk_Flexible_Shipping::META_DEFAULT => $method_settings->get_default(),
307
  self::FS_METHOD => $method_settings->get_raw_settings(),
308
  self::FS_INTEGRATION => $method_settings->get_integration(),
309
+ self::DESCRIPTION => $description,
 
310
  );
311
 
312
+ if ( esc_html( $description ) !== $description ) {
313
+ $meta_data[ self::DESCRIPTION_BASE64ENCODED ] = base64_encode( $description );
314
+ }
315
+
316
  /**
317
  * Rate metadata.
318
  *
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit6f06d93ca5f5bd8e131a01dd5bc0f6f3::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInitb8f8eaa54571b48c5416004559e42e26::getLoader();
vendor/composer/autoload_classmap.php CHANGED
@@ -409,6 +409,7 @@ return array(
409
  'WPDesk\\FS\\Rate\\RateNoticeImplementation' => $baseDir . '/classes/wp-wpdesk-fs-shipment/rate-notices/rate-notice-implementation.php',
410
  'WPDesk\\FS\\Rate\\RateNoticeInterface' => $baseDir . '/classes/wp-wpdesk-fs-shipment/rate-notices/interface-rate.php',
411
  'WPDesk\\FS\\Rate\\WPDesk_Flexible_Shipping_Rate_Notice' => $baseDir . '/classes/wp-wpdesk-fs-shipment/rate-notice.php',
 
412
  'WPDesk\\FS\\TableRate\\Beacon' => $baseDir . '/src/WPDesk/FS/TableRate/Beacon.php',
413
  'WPDesk\\FS\\TableRate\\Beacon\\Beacon' => $baseDir . '/src/WPDesk/FS/TableRate/Beacon/Beacon.php',
414
  'WPDesk\\FS\\TableRate\\Beacon\\BeaconClickedAjax' => $baseDir . '/src/WPDesk/FS/TableRate/Beacon/BeaconClickedAjax.php',
409
  'WPDesk\\FS\\Rate\\RateNoticeImplementation' => $baseDir . '/classes/wp-wpdesk-fs-shipment/rate-notices/rate-notice-implementation.php',
410
  'WPDesk\\FS\\Rate\\RateNoticeInterface' => $baseDir . '/classes/wp-wpdesk-fs-shipment/rate-notices/interface-rate.php',
411
  'WPDesk\\FS\\Rate\\WPDesk_Flexible_Shipping_Rate_Notice' => $baseDir . '/classes/wp-wpdesk-fs-shipment/rate-notice.php',
412
+ 'WPDesk\\FS\\Shipment\\SubscriptionsIntegration' => $baseDir . '/src/WPDesk/FS/Shipment/SubscriptionsIntegration.php',
413
  'WPDesk\\FS\\TableRate\\Beacon' => $baseDir . '/src/WPDesk/FS/TableRate/Beacon.php',
414
  'WPDesk\\FS\\TableRate\\Beacon\\Beacon' => $baseDir . '/src/WPDesk/FS/TableRate/Beacon/Beacon.php',
415
  'WPDesk\\FS\\TableRate\\Beacon\\BeaconClickedAjax' => $baseDir . '/src/WPDesk/FS/TableRate/Beacon/BeaconClickedAjax.php',
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit6f06d93ca5f5bd8e131a01dd5bc0f6f3
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInit6f06d93ca5f5bd8e131a01dd5bc0f6f3
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInit6f06d93ca5f5bd8e131a01dd5bc0f6f3', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
- spl_autoload_unregister(array('ComposerAutoloaderInit6f06d93ca5f5bd8e131a01dd5bc0f6f3', '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\ComposerStaticInit6f06d93ca5f5bd8e131a01dd5bc0f6f3::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
@@ -51,19 +51,19 @@ class ComposerAutoloaderInit6f06d93ca5f5bd8e131a01dd5bc0f6f3
51
  $loader->register(true);
52
 
53
  if ($useStaticLoader) {
54
- $includeFiles = Composer\Autoload\ComposerStaticInit6f06d93ca5f5bd8e131a01dd5bc0f6f3::$files;
55
  } else {
56
  $includeFiles = require __DIR__ . '/autoload_files.php';
57
  }
58
  foreach ($includeFiles as $fileIdentifier => $file) {
59
- composerRequire6f06d93ca5f5bd8e131a01dd5bc0f6f3($fileIdentifier, $file);
60
  }
61
 
62
  return $loader;
63
  }
64
  }
65
 
66
- function composerRequire6f06d93ca5f5bd8e131a01dd5bc0f6f3($fileIdentifier, $file)
67
  {
68
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
69
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInitb8f8eaa54571b48c5416004559e42e26
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInitb8f8eaa54571b48c5416004559e42e26', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
+ spl_autoload_unregister(array('ComposerAutoloaderInitb8f8eaa54571b48c5416004559e42e26', '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\ComposerStaticInitb8f8eaa54571b48c5416004559e42e26::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
51
  $loader->register(true);
52
 
53
  if ($useStaticLoader) {
54
+ $includeFiles = Composer\Autoload\ComposerStaticInitb8f8eaa54571b48c5416004559e42e26::$files;
55
  } else {
56
  $includeFiles = require __DIR__ . '/autoload_files.php';
57
  }
58
  foreach ($includeFiles as $fileIdentifier => $file) {
59
+ composerRequireb8f8eaa54571b48c5416004559e42e26($fileIdentifier, $file);
60
  }
61
 
62
  return $loader;
63
  }
64
  }
65
 
66
+ function composerRequireb8f8eaa54571b48c5416004559e42e26($fileIdentifier, $file)
67
  {
68
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
69
  require $file;
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit6f06d93ca5f5bd8e131a01dd5bc0f6f3
8
  {
9
  public static $files = array (
10
  '0509b34a4bd7aebefeac629c9dc8a978' => __DIR__ . '/..' . '/wpdesk/wp-notice/src/WPDesk/notice-functions.php',
@@ -450,6 +450,7 @@ class ComposerStaticInit6f06d93ca5f5bd8e131a01dd5bc0f6f3
450
  'WPDesk\\FS\\Rate\\RateNoticeImplementation' => __DIR__ . '/../..' . '/classes/wp-wpdesk-fs-shipment/rate-notices/rate-notice-implementation.php',
451
  'WPDesk\\FS\\Rate\\RateNoticeInterface' => __DIR__ . '/../..' . '/classes/wp-wpdesk-fs-shipment/rate-notices/interface-rate.php',
452
  'WPDesk\\FS\\Rate\\WPDesk_Flexible_Shipping_Rate_Notice' => __DIR__ . '/../..' . '/classes/wp-wpdesk-fs-shipment/rate-notice.php',
 
453
  'WPDesk\\FS\\TableRate\\Beacon' => __DIR__ . '/../..' . '/src/WPDesk/FS/TableRate/Beacon.php',
454
  'WPDesk\\FS\\TableRate\\Beacon\\Beacon' => __DIR__ . '/../..' . '/src/WPDesk/FS/TableRate/Beacon/Beacon.php',
455
  'WPDesk\\FS\\TableRate\\Beacon\\BeaconClickedAjax' => __DIR__ . '/../..' . '/src/WPDesk/FS/TableRate/Beacon/BeaconClickedAjax.php',
@@ -630,10 +631,10 @@ class ComposerStaticInit6f06d93ca5f5bd8e131a01dd5bc0f6f3
630
  public static function getInitializer(ClassLoader $loader)
631
  {
632
  return \Closure::bind(function () use ($loader) {
633
- $loader->prefixLengthsPsr4 = ComposerStaticInit6f06d93ca5f5bd8e131a01dd5bc0f6f3::$prefixLengthsPsr4;
634
- $loader->prefixDirsPsr4 = ComposerStaticInit6f06d93ca5f5bd8e131a01dd5bc0f6f3::$prefixDirsPsr4;
635
- $loader->fallbackDirsPsr4 = ComposerStaticInit6f06d93ca5f5bd8e131a01dd5bc0f6f3::$fallbackDirsPsr4;
636
- $loader->classMap = ComposerStaticInit6f06d93ca5f5bd8e131a01dd5bc0f6f3::$classMap;
637
 
638
  }, null, ClassLoader::class);
639
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInitb8f8eaa54571b48c5416004559e42e26
8
  {
9
  public static $files = array (
10
  '0509b34a4bd7aebefeac629c9dc8a978' => __DIR__ . '/..' . '/wpdesk/wp-notice/src/WPDesk/notice-functions.php',
450
  'WPDesk\\FS\\Rate\\RateNoticeImplementation' => __DIR__ . '/../..' . '/classes/wp-wpdesk-fs-shipment/rate-notices/rate-notice-implementation.php',
451
  'WPDesk\\FS\\Rate\\RateNoticeInterface' => __DIR__ . '/../..' . '/classes/wp-wpdesk-fs-shipment/rate-notices/interface-rate.php',
452
  'WPDesk\\FS\\Rate\\WPDesk_Flexible_Shipping_Rate_Notice' => __DIR__ . '/../..' . '/classes/wp-wpdesk-fs-shipment/rate-notice.php',
453
+ 'WPDesk\\FS\\Shipment\\SubscriptionsIntegration' => __DIR__ . '/../..' . '/src/WPDesk/FS/Shipment/SubscriptionsIntegration.php',
454
  'WPDesk\\FS\\TableRate\\Beacon' => __DIR__ . '/../..' . '/src/WPDesk/FS/TableRate/Beacon.php',
455
  'WPDesk\\FS\\TableRate\\Beacon\\Beacon' => __DIR__ . '/../..' . '/src/WPDesk/FS/TableRate/Beacon/Beacon.php',
456
  'WPDesk\\FS\\TableRate\\Beacon\\BeaconClickedAjax' => __DIR__ . '/../..' . '/src/WPDesk/FS/TableRate/Beacon/BeaconClickedAjax.php',
631
  public static function getInitializer(ClassLoader $loader)
632
  {
633
  return \Closure::bind(function () use ($loader) {
634
+ $loader->prefixLengthsPsr4 = ComposerStaticInitb8f8eaa54571b48c5416004559e42e26::$prefixLengthsPsr4;
635
+ $loader->prefixDirsPsr4 = ComposerStaticInitb8f8eaa54571b48c5416004559e42e26::$prefixDirsPsr4;
636
+ $loader->fallbackDirsPsr4 = ComposerStaticInitb8f8eaa54571b48c5416004559e42e26::$fallbackDirsPsr4;
637
+ $loader->classMap = ComposerStaticInitb8f8eaa54571b48c5416004559e42e26::$classMap;
638
 
639
  }, null, ClassLoader::class);
640
  }
vendor_prefixed/wpdesk/wp-code-sniffer/composer.json CHANGED
@@ -9,7 +9,7 @@
9
  ],
10
  "homepage": "https:\/\/gitlab.com\/wpdesk\/wp-code-sniffer",
11
  "type": "phpcodesniffer-standard",
12
- "minimum-stability": "stable",
13
  "authors": [
14
  {
15
  "name": "grola",
@@ -17,7 +17,7 @@
17
  }
18
  ],
19
  "require": {
20
- "dealerdirect\/phpcodesniffer-composer-installer": "^0.6.2",
21
  "phpcompatibility\/php-compatibility": "^9.3",
22
  "squizlabs\/php_codesniffer": "^3.5",
23
  "wp-coding-standards\/wpcs": "^2.2"
9
  ],
10
  "homepage": "https:\/\/gitlab.com\/wpdesk\/wp-code-sniffer",
11
  "type": "phpcodesniffer-standard",
12
+ "prefer-stable": true,
13
  "authors": [
14
  {
15
  "name": "grola",
17
  }
18
  ],
19
  "require": {
20
+ "dealerdirect\/phpcodesniffer-composer-installer": "0.6|^0.7",
21
  "phpcompatibility\/php-compatibility": "^9.3",
22
  "squizlabs\/php_codesniffer": "^3.5",
23
  "wp-coding-standards\/wpcs": "^2.2"
vendor_prefixed/wpdesk/wp-codeception/composer.json CHANGED
@@ -20,7 +20,7 @@
20
  "php": ">=5.6",
21
  "ext-json": "*",
22
  "wpdesk\/wp-builder": "^1.0",
23
- "composer-plugin-api": "^1.1",
24
  "codeception\/module-db": "^1.0",
25
  "codeception\/module-cli": "^1.0",
26
  "codeception\/module-webdriver": "^1.0",
20
  "php": ">=5.6",
21
  "ext-json": "*",
22
  "wpdesk\/wp-builder": "^1.0",
23
+ "composer-plugin-api": "^1.1|^2",
24
  "codeception\/module-db": "^1.0",
25
  "codeception\/module-cli": "^1.0",
26
  "codeception\/module-webdriver": "^1.0",
vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Plugin.php CHANGED
@@ -26,6 +26,22 @@ class Plugin implements \FSVendor\Composer\Plugin\PluginInterface, \FSVendor\Com
26
  $this->composer = $composer;
27
  $this->io = $io;
28
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  public function getCapabilities()
30
  {
31
  return [\FSVendor\Composer\Plugin\Capability\CommandProvider::class => \FSVendor\WPDesk\Composer\Codeception\CommandProvider::class];
26
  $this->composer = $composer;
27
  $this->io = $io;
28
  }
29
+ /**
30
+ * @inheritDoc
31
+ */
32
+ public function deactivate(\FSVendor\Composer\Composer $composer, \FSVendor\Composer\IO\IOInterface $io)
33
+ {
34
+ $this->composer = $composer;
35
+ $this->io = $io;
36
+ }
37
+ /**
38
+ * @inheritDoc
39
+ */
40
+ public function uninstall(\FSVendor\Composer\Composer $composer, \FSVendor\Composer\IO\IOInterface $io)
41
+ {
42
+ $this->composer = $composer;
43
+ $this->io = $io;
44
+ }
45
  public function getCapabilities()
46
  {
47
  return [\FSVendor\Composer\Plugin\Capability\CommandProvider::class => \FSVendor\WPDesk\Composer\Codeception\CommandProvider::class];