Printful Integration for WooCommerce - Version 2.1.13

Version Description

Woocommerce compatibility raised to 4.3

Download this release

Release Info

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

Code changes from version 2.1.12 to 2.1.13

includes/class-printful-rest-api-controller.php CHANGED
@@ -129,19 +129,20 @@ class Printful_REST_API_Controller extends WC_REST_Controller
129
  }
130
 
131
  //product exists
132
- $product = get_post( $product_id );
133
- if ( empty( $product ) || $product->post_type != 'product' ) {
 
134
  return new WP_Error( 'printful_api_product_not_found', __( 'The product is not found', 'printful' ), array('status' => 400));
135
  }
136
 
137
  //how about permissions?
138
- $post_type = get_post_type_object( $product->post_type );
139
- if ( ! current_user_can( $post_type->cap->edit_post, $product->ID ) ) {
140
  return new WP_Error( 'printful_api_user_cannot_edit_product_size_chart', __( 'You do not have permission to edit the size chart', 'printful' ), array('status' => 401));
141
  }
142
 
143
  //lets do this
144
- update_post_meta( $product_id, 'pf_size_chart', htmlspecialchars( $data['size_chart'] ) );
145
 
146
  return array(
147
  'product' => $product,
@@ -222,9 +223,9 @@ class Printful_REST_API_Controller extends WC_REST_Controller
222
  */
223
  public function update_item_permissions_check( $request ) {
224
  $params = $request->get_url_params();
225
- $post = get_post( (int) $params['product_id'] );
226
 
227
- if ( $post && ! wc_rest_check_post_permissions( 'product', 'edit', $post->ID ) ) {
228
  return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
229
  }
230
 
129
  }
130
 
131
  //product exists
132
+ /** @var WC_Product $product */
133
+ $product = wc_get_product( $product_id );
134
+ if ( empty( $product )) {
135
  return new WP_Error( 'printful_api_product_not_found', __( 'The product is not found', 'printful' ), array('status' => 400));
136
  }
137
 
138
  //how about permissions?
139
+ $post_type = get_post_type_object( 'product' );
140
+ if ( ! current_user_can( $post_type->cap->edit_post, $product->get_id() ) ) {
141
  return new WP_Error( 'printful_api_user_cannot_edit_product_size_chart', __( 'You do not have permission to edit the size chart', 'printful' ), array('status' => 401));
142
  }
143
 
144
  //lets do this
145
+ update_post_meta( $product->get_id(), 'pf_size_chart', htmlspecialchars( $data['size_chart'] ) );
146
 
147
  return array(
148
  'product' => $product,
223
  */
224
  public function update_item_permissions_check( $request ) {
225
  $params = $request->get_url_params();
226
+ $product = wc_get_product( (int) $params['product_id'] );
227
 
228
+ if ( empty( $product ) && ! wc_rest_check_post_permissions( 'product', 'edit', $product->get_id() ) ) {
229
  return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
230
  }
231
 
printful-shipping.php CHANGED
@@ -3,13 +3,13 @@
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.1.12
7
  Author: Printful
8
  Author URI: http://www.printful.com
9
  License: GPL2 http://www.gnu.org/licenses/gpl-2.0.html
10
  Text Domain: printful
11
  WC requires at least: 3.0.0
12
- WC tested up to: 4.2
13
  */
14
 
15
  if ( ! defined( 'ABSPATH' ) ) exit;
@@ -20,7 +20,7 @@ if ( ! defined( 'PF_PLUGIN_FILE' ) ) {
20
 
21
  class Printful_Base {
22
 
23
- const VERSION = '2.1.12';
24
  const PF_HOST = 'https://www.printful.com/';
25
  const PF_API_HOST = 'https://api.printful.com/';
26
 
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.1.13
7
  Author: Printful
8
  Author URI: http://www.printful.com
9
  License: GPL2 http://www.gnu.org/licenses/gpl-2.0.html
10
  Text Domain: printful
11
  WC requires at least: 3.0.0
12
+ WC tested up to: 4.3
13
  */
14
 
15
  if ( ! defined( 'ABSPATH' ) ) exit;
20
 
21
  class Printful_Base {
22
 
23
+ const VERSION = '2.1.13';
24
  const PF_HOST = 'https://www.printful.com/';
25
  const PF_API_HOST = 'https://api.printful.com/';
26
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: woocommerce, printful, drop shipping, shipping, shipping rates, fulfillmen
4
  Requires at least: 4.9
5
  Tested up to: 5.4
6
  Requires PHP: 5.6
7
- Stable tag: 2.1.12
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -65,6 +65,9 @@ Go to https://www.printful.com/dashboard/store , select your WooCommerce store,
65
 
66
  == Upgrade Notice ==
67
 
 
 
 
68
  = 2.1.12 =
69
  Woocommerce compatibility raised to 4.2
70
 
@@ -178,6 +181,12 @@ First release
178
 
179
  == Changelog ==
180
 
 
 
 
 
 
 
181
  = 2.1.11 =
182
  * Improved support for WooCommerce 4.1
183
 
4
  Requires at least: 4.9
5
  Tested up to: 5.4
6
  Requires PHP: 5.6
7
+ Stable tag: 2.1.13
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
65
 
66
  == Upgrade Notice ==
67
 
68
+ = 2.1.13 =
69
+ Woocommerce compatibility raised to 4.3
70
+
71
  = 2.1.12 =
72
  Woocommerce compatibility raised to 4.2
73
 
181
 
182
  == Changelog ==
183
 
184
+ = 2.1.13 =
185
+ * Improved support for WooCommerce 4.3
186
+
187
+ = 2.1.12 =
188
+ * Improved support for WooCommerce 4.2
189
+
190
  = 2.1.11 =
191
  * Improved support for WooCommerce 4.1
192