Printful Integration for WooCommerce - Version 2.0.2

Version Description

Improved compatibility with WC 3.3.0

Download this release

Release Info

Developer printful
Plugin Icon 128x128 Printful Integration for WooCommerce
Version 2.0.2
Comparing to
See all releases

Code changes from version 2.0.1 to 2.0.2

includes/class-printful-admin-status.php CHANGED
@@ -305,6 +305,7 @@ class Printful_Admin_Status {
305
  * @return int
306
  */
307
  private function check_PF_webhooks() {
 
308
 
309
  // Query args
310
  $args = array(
@@ -315,15 +316,24 @@ class Printful_Admin_Status {
315
  'post_status' => 'published',
316
  );
317
 
318
- // Get the webhooks
319
- $webhook_results = new WP_Query( $args );
320
- $webhooks = $webhook_results->posts;
 
 
 
 
 
 
 
 
 
321
 
322
- if ( count( $webhooks ) > 0 ) {
323
- return self::PF_STATUS_OK;
324
- }
325
 
326
- return self::PF_STATUS_FAIL;
327
  }
328
 
329
  /**
@@ -346,6 +356,8 @@ class Printful_Admin_Status {
346
  $query = "SELECT * FROM {$wpdb->prefix}woocommerce_api_keys WHERE 1 = 1 {$search} ORDER BY last_access DESC LIMIT 1";
347
  $key = $wpdb->get_row( $query );
348
 
 
 
349
  if ( ! empty( $key ) && $key->permissions == 'read_write' ) {
350
  return self::PF_STATUS_OK;
351
  }
305
  * @return int
306
  */
307
  private function check_PF_webhooks() {
308
+ global $wpdb;
309
 
310
  // Query args
311
  $args = array(
316
  'post_status' => 'published',
317
  );
318
 
319
+ // Get the webhooks
320
+ // In version 3.3 the webhooks are stored in separate table, before that they were stored in posts table
321
+ if (version_compare(WC()->version, '3.3', '<')) {
322
+ $webhook_results = new WP_Query($args);
323
+ $webhooks = $webhook_results->posts;
324
+ $count = count($webhooks) > 0;
325
+ } else {
326
+ $count = $wpdb->get_var(
327
+ $wpdb->prepare("SELECT COUNT(*) as webhook_count FROM {$wpdb->prefix}wc_webhooks WHERE name = %s",
328
+ self::PF_WEBHOOK_NAME
329
+ ));
330
+ }
331
 
332
+ if ($count > 0) {
333
+ return self::PF_STATUS_OK;
334
+ }
335
 
336
+ return self::PF_STATUS_FAIL;
337
  }
338
 
339
  /**
356
  $query = "SELECT * FROM {$wpdb->prefix}woocommerce_api_keys WHERE 1 = 1 {$search} ORDER BY last_access DESC LIMIT 1";
357
  $key = $wpdb->get_row( $query );
358
 
359
+
360
+
361
  if ( ! empty( $key ) && $key->permissions == 'read_write' ) {
362
  return self::PF_STATUS_OK;
363
  }
printful-shipping.php CHANGED
@@ -3,19 +3,19 @@
3
  Plugin Name: Printful Integration for WooCommerce
4
  Plugin URI: https://wordpress.org/plugins/printful-shipping-for-woocommerce/
5
  Description: Calculate correct shipping and tax rates for your Printful-Woocommerce integration.
6
- Version: 2.0.1
7
  Author: Printful
8
  Author URI: http://www.printful.com
9
  License: GPL2 http://www.gnu.org/licenses/gpl-2.0.html
10
  WC requires at least: 3.0.0
11
- WC tested up to: 3.2.0
12
  */
13
 
14
  if ( ! defined( 'ABSPATH' ) ) exit;
15
 
16
  class Printful_Base {
17
 
18
- const VERSION = '2.0.1';
19
  const PF_HOST = 'https://www.printful.com/';
20
  const PF_API_HOST = 'https://api.printful.com/';
21
 
3
  Plugin Name: Printful Integration for WooCommerce
4
  Plugin URI: https://wordpress.org/plugins/printful-shipping-for-woocommerce/
5
  Description: Calculate correct shipping and tax rates for your Printful-Woocommerce integration.
6
+ Version: 2.0.2
7
  Author: Printful
8
  Author URI: http://www.printful.com
9
  License: GPL2 http://www.gnu.org/licenses/gpl-2.0.html
10
  WC requires at least: 3.0.0
11
+ WC tested up to: 3.3.0
12
  */
13
 
14
  if ( ! defined( 'ABSPATH' ) ) exit;
15
 
16
  class Printful_Base {
17
 
18
+ const VERSION = '2.0.2';
19
  const PF_HOST = 'https://www.printful.com/';
20
  const PF_API_HOST = 'https://api.printful.com/';
21
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: girts_u, kievins
3
  Tags: woocommerce, printful, drop shipping, shipping, shipping rates, fulfillment, printing, fedex, carriers, checkout, t-shirts
4
  Requires at least: 3.8
5
  Tested up to: 4.8
6
- Stable tag: 2.0.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -38,6 +38,9 @@ Go to https://www.printful.com/dashboard/store , select your WooCommerce store,
38
 
39
  == Upgrade Notice ==
40
 
 
 
 
41
  = 2.0.1 =
42
  Fixed various minor issues
43
 
@@ -91,6 +94,9 @@ First release
91
 
92
  == Changelog ==
93
 
 
 
 
94
  = 2.0.1 =
95
  * Improved Printful connection status detection
96
  * Improvements for system report
3
  Tags: woocommerce, printful, drop shipping, shipping, shipping rates, fulfillment, printing, fedex, carriers, checkout, t-shirts
4
  Requires at least: 3.8
5
  Tested up to: 4.8
6
+ Stable tag: 2.0.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
38
 
39
  == Upgrade Notice ==
40
 
41
+ = 2.0.2 =
42
+ Improved compatibility with WC 3.3.0
43
+
44
  = 2.0.1 =
45
  Fixed various minor issues
46
 
94
 
95
  == Changelog ==
96
 
97
+ = 2.0.2 =
98
+ * Fixed incorrect webhook status indication since WC 3.3.0
99
+
100
  = 2.0.1 =
101
  * Improved Printful connection status detection
102
  * Improvements for system report