Printful Integration for WooCommerce - Version 1.2.2

Version Description

Fixed PHP warning on Woocommerce 2.6

Download this release

Release Info

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

Code changes from version 1.2.1 to 1.2.2

includes/class-printful-integration.php CHANGED
@@ -97,23 +97,12 @@ class Printful_Integration extends WC_Integration
97
  'label' => 'Use HTTP instead of HTTPS to connect to the Printful API (may be required if the plugin does not work for some hosting configurations)',
98
  'default' => 'no'
99
  ),
100
- );
101
- }
102
-
103
- public function generate_settings_html($form_fields = false)
104
- {
105
- parent::generate_settings_html($form_fields);
106
 
107
- ?>
108
- <tr valign="top">
109
- <th scope="row" class="titledesc">
110
- <label >Calculate shipping rates</label>
111
- </th>
112
- <td class="forminp">
113
- Go to <b><a href="<?php echo admin_url('admin.php?page=wc-settings&tab=shipping&section=printful_shipping') ?>">Shipping → Printful Shipping</a></b> to enable Printful shipping rate calculation
114
- </td>
115
- </tr>
116
- <?php
117
  }
118
 
119
  public function calculate_tax($matched_tax_rates, $country, $state, $postcode, $city, $tax_class)
97
  'label' => 'Use HTTP instead of HTTPS to connect to the Printful API (may be required if the plugin does not work for some hosting configurations)',
98
  'default' => 'no'
99
  ),
100
+ 'info' => array(
101
+ 'type' => 'title',
102
+ 'description' => 'Go to <b><a href="' . admin_url('admin.php?page=wc-settings&tab=shipping&section=printful_shipping') . '">Shipping → Printful Shipping</a></b> to enable Printful shipping rate calculation'
103
+ )
 
 
104
 
105
+ );
 
 
 
 
 
 
 
 
 
106
  }
107
 
108
  public function calculate_tax($matched_tax_rates, $country, $state, $postcode, $city, $tax_class)
includes/class-printful-shipping.php CHANGED
@@ -30,30 +30,9 @@ class Printful_Shipping extends WC_Shipping_Method
30
  //Remove other shipping methods for Printful package on WC < 2.6
31
  add_filter('woocommerce_shipping_methods', array($this, 'woocommerce_shipping_methods'), 10000);
32
 
33
- add_filter('woocommerce_cart_shipping_packages', array($this, 'woocommerce_cart_shipping_packages'));
34
 
35
  }
36
-
37
- public function generate_settings_html($form_fields = false)
38
- {
39
- if (empty(Printful_Integration::instance()->settings['printful_key']))
40
- {
41
- ?>
42
- <tr><td colspan="2">
43
- <div class="error below-h2" style="margin:0">
44
- <p>
45
- Please add Printful API key to the
46
- <a href="<?php echo admin_url('admin.php?page=wc-settings&tab=integration&section=printful') ?>">Printful Integration settings section</a>
47
- to enable rate calculation.
48
- </p>
49
- </div>
50
- </td></tr>
51
- <?php
52
- }
53
- parent::generate_settings_html($form_fields);
54
-
55
- }
56
-
57
  public function init_form_fields()
58
  {
59
  $this->form_fields = array(
@@ -70,6 +49,15 @@ class Printful_Shipping extends WC_Shipping_Method
70
  'default' => 'yes'
71
  )
72
  );
 
 
 
 
 
 
 
 
 
73
  }
74
 
75
  //Enable only Printful shipping method for Printful packages
30
  //Remove other shipping methods for Printful package on WC < 2.6
31
  add_filter('woocommerce_shipping_methods', array($this, 'woocommerce_shipping_methods'), 10000);
32
 
33
+ add_filter('woocommerce_cart_shipping_packages', array($this, 'woocommerce_cart_shipping_packages', 10000));
34
 
35
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  public function init_form_fields()
37
  {
38
  $this->form_fields = array(
49
  'default' => 'yes'
50
  )
51
  );
52
+
53
+ if (empty(Printful_Integration::instance()->settings['printful_key'])) {
54
+ $this->form_fields['info'] = array(
55
+ 'type' => 'title',
56
+ 'description' => 'Please add Printful API key to the
57
+ <a href="'. admin_url('admin.php?page=wc-settings&tab=integration&section=printful') .'">Printful Integration settings section</a>
58
+ to enable rate calculation.'
59
+ );
60
+ }
61
  }
62
 
63
  //Enable only Printful shipping method for Printful packages
printful-shipping.php CHANGED
@@ -3,7 +3,7 @@
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: 1.2.1
7
  Author: Printful
8
  Author URI: http://www.theprintful.com
9
  License: GPL2 http://www.gnu.org/licenses/gpl-2.0.html
@@ -16,7 +16,7 @@ new Printful_Base();
16
 
17
  class Printful_Base {
18
 
19
- const VERSION = '1.2.1';
20
 
21
  /**
22
  * Construct the plugin.
@@ -36,7 +36,7 @@ class Printful_Base {
36
 
37
  //Register API endpoint
38
  add_filter('woocommerce_api_classes', array($this, 'add_api_resource'));
39
-
40
  require_once 'includes/class-printful-shipping.php';
41
  new Printful_Shipping();
42
  }
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: 1.2.2
7
  Author: Printful
8
  Author URI: http://www.theprintful.com
9
  License: GPL2 http://www.gnu.org/licenses/gpl-2.0.html
16
 
17
  class Printful_Base {
18
 
19
+ const VERSION = '1.2.2';
20
 
21
  /**
22
  * Construct the plugin.
36
 
37
  //Register API endpoint
38
  add_filter('woocommerce_api_classes', array($this, 'add_api_resource'));
39
+ require_once 'includes/class-printful-integration.php';
40
  require_once 'includes/class-printful-shipping.php';
41
  new Printful_Shipping();
42
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: girts_u
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.5.2
6
- Stable tag: 1.2.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -40,9 +40,12 @@ Go to https://www.theprintful.com/dashboard/store , select your WooCommerce stor
40
  3. Shipping rate selection
41
 
42
  == Upgrade Notice ==
43
-
 
 
 
44
  = 1.2.1 =
45
- Fixed bug
46
 
47
  = 1.2 =
48
  Support calculating shipping rates for both Printful and non-Printful products at the same time
@@ -66,10 +69,13 @@ Minor improvements
66
  First release
67
 
68
  == Changelog ==
69
-
70
-
 
 
 
71
  = 1.2.1 =
72
- * Fixed bug that could have show error message when calculating shipping rates
73
 
74
  = 1.2 =
75
  * Support calculating shipping rates for both Printful and non-Printful products at the same time (non-Printful
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.5.2
6
+ Stable tag: 1.2.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
40
  3. Shipping rate selection
41
 
42
  == Upgrade Notice ==
43
+
44
+ = 1.2.2 =
45
+ Fixed PHP warning on Woocommerce 2.6
46
+
47
  = 1.2.1 =
48
+ Fixed bug
49
 
50
  = 1.2 =
51
  Support calculating shipping rates for both Printful and non-Printful products at the same time
69
  First release
70
 
71
  == Changelog ==
72
+
73
+ = 1.2.2 =
74
+ * Fixed PHP warning on Woocommerce 2.6 due to changed method signature
75
+ * Fixed conflict with "Multiple Packages for WooCommerce" plugin
76
+
77
  = 1.2.1 =
78
+ * Fixed bug that could have show error message when calculating shipping rates
79
 
80
  = 1.2 =
81
  * Support calculating shipping rates for both Printful and non-Printful products at the same time (non-Printful