Printful Integration for WooCommerce - Version 2.1.1

Version Description

Improved support for WooCommerce 3.6 and other minor bug fixes

Download this release

Release Info

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

Code changes from version 2.1 to 2.1.1

assets/js/product-customizer.js CHANGED
@@ -19,6 +19,11 @@ var Printful_Product_Customizer;
19
  onCustomizeClick: function (site_url) {
20
  var variation_id = jQuery('input[name="variation_id"]').val(); // get selected variation ID
21
 
 
 
 
 
 
22
  if (!variation_id) {
23
  return;
24
  }
@@ -140,7 +145,7 @@ var Printful_Product_Customizer;
140
  jQuery('#pfc_hash').val(hash);
141
  this.closeModal();
142
 
143
- jQuery('.variations_form').submit();
144
  }
145
  };
146
  })();
19
  onCustomizeClick: function (site_url) {
20
  var variation_id = jQuery('input[name="variation_id"]').val(); // get selected variation ID
21
 
22
+ if (!variation_id) {
23
+ // if variation does not exist, probably means single variant product
24
+ variation_id = jQuery('button[name="add-to-cart"]').val();
25
+ }
26
+
27
  if (!variation_id) {
28
  return;
29
  }
145
  jQuery('#pfc_hash').val(hash);
146
  this.closeModal();
147
 
148
+ jQuery('.single_add_to_cart_button').click();
149
  }
150
  };
151
  })();
includes/class-printful-customizer.php CHANGED
@@ -19,8 +19,9 @@ class Printful_Customizer {
19
  add_filter( 'woocommerce_add_cart_item_data', array( $this, 'save_customizer_hash_data_to_cart' ), 10, 1 );
20
  add_filter( 'woocommerce_cart_item_thumbnail', array( $this, 'change_woocommerce_cart_item_thumbnail' ), 20, 2 );
21
  // add property to order
22
- add_action('woocommerce_add_order_item_meta', array( $this, 'save_customizer_hash_order_meta' ), 10, 3 );
23
-
 
24
  add_action( 'wp_ajax_printful_customized_thumb', array( $this, 'printful_customized_thumb' ) );
25
  add_action( 'wp_ajax_nopriv_printful_customized_thumb', array( $this, 'printful_customized_thumb' ) );
26
  }
@@ -43,6 +44,11 @@ class Printful_Customizer {
43
  return $cart_item_data;
44
  }
45
 
 
 
 
 
 
46
  public function change_woocommerce_cart_item_thumbnail( $thumbnail, $cart_item )
47
  {
48
  if ( $cart_item
@@ -70,11 +76,10 @@ class Printful_Customizer {
70
  /**
71
  * @param $itemId
72
  * @param $values
73
- * @param $key
74
  *
75
  * @throws Exception
76
  */
77
- public function save_customizer_hash_order_meta( $itemId, $values, $key )
78
  {
79
  if ( isset( $values['pfc_hash'] ) ) {
80
  wc_add_order_item_meta( $itemId, 'pfc_hash', $values['pfc_hash'] );
@@ -119,4 +124,20 @@ class Printful_Customizer {
119
  echo json_encode($response);
120
  exit;
121
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  }
19
  add_filter( 'woocommerce_add_cart_item_data', array( $this, 'save_customizer_hash_data_to_cart' ), 10, 1 );
20
  add_filter( 'woocommerce_cart_item_thumbnail', array( $this, 'change_woocommerce_cart_item_thumbnail' ), 20, 2 );
21
  // add property to order
22
+ add_action('woocommerce_add_order_item_meta', array( $this, 'save_customizer_hash_order_meta' ), 10, 2 );
23
+ // hide hash from meta data provided to user
24
+ add_filter( 'woocommerce_order_item_get_formatted_meta_data', array( $this, 'hide_hash_from_meta_data'), 10, 1 );
25
  add_action( 'wp_ajax_printful_customized_thumb', array( $this, 'printful_customized_thumb' ) );
26
  add_action( 'wp_ajax_nopriv_printful_customized_thumb', array( $this, 'printful_customized_thumb' ) );
27
  }
44
  return $cart_item_data;
45
  }
46
 
47
+ /**
48
+ * @param $thumbnail
49
+ * @param $cart_item
50
+ * @return string
51
+ */
52
  public function change_woocommerce_cart_item_thumbnail( $thumbnail, $cart_item )
53
  {
54
  if ( $cart_item
76
  /**
77
  * @param $itemId
78
  * @param $values
 
79
  *
80
  * @throws Exception
81
  */
82
+ public function save_customizer_hash_order_meta( $itemId, $values )
83
  {
84
  if ( isset( $values['pfc_hash'] ) ) {
85
  wc_add_order_item_meta( $itemId, 'pfc_hash', $values['pfc_hash'] );
124
  echo json_encode($response);
125
  exit;
126
  }
127
+
128
+ /**
129
+ * Hide pfc_hash from UI
130
+ * @param array $formatted_meta
131
+ * @return mixed
132
+ */
133
+ public function hide_hash_from_meta_data( $formatted_meta )
134
+ {
135
+ foreach( $formatted_meta as $key => $meta ) {
136
+ if ( in_array( $meta->key, array( 'pfc_hash' ) ) ) {
137
+ unset( $formatted_meta[$key] );
138
+ }
139
+ }
140
+
141
+ return $formatted_meta;
142
+ }
143
  }
includes/class-printful-size-chart-tab.php CHANGED
@@ -115,11 +115,6 @@ class Printful_Size_Chart_Tab {
115
  return;
116
  }
117
 
118
- //check if not empty
119
- if ( empty( $_POST['pf_size_chart'] ) ) {
120
- return;
121
- }
122
-
123
  // We need this save event to run once to avoid potential endless loops.
124
  self::$saved_meta_boxes = true;
125
 
115
  return;
116
  }
117
 
 
 
 
 
 
118
  // We need this save event to run once to avoid potential endless loops.
119
  self::$saved_meta_boxes = true;
120
 
includes/templates/personalize-button.php CHANGED
@@ -1,5 +1,6 @@
1
  <?php
2
  /**
 
3
  * @var string $site_url
4
  * @var string $pfc_button_text
5
  */
1
  <?php
2
  /**
3
+ * @var string $pfc_button_color
4
  * @var string $site_url
5
  * @var string $pfc_button_text
6
  */
includes/templates/setting-group.php CHANGED
@@ -36,7 +36,7 @@
36
 
37
  <?php if ( $setting['type'] == 'text' ) : ?>
38
 
39
- <input class="input-text regular-input" type="text" name="<?php echo esc_attr($key); ?>" id="<?php echo esc_attr($key); ?>" value="<?php echo esc_html($setting['value']); ?>" placeholder="">
40
 
41
  <?php elseif ($setting['type'] == 'checkbox') : ?>
42
 
@@ -71,7 +71,7 @@
71
 
72
  <?php elseif ($setting['type'] == 'color-picker') : ?>
73
  <label for="<?php esc_attr_e($key); ?>">
74
- <input type="text" name="<?php esc_attr_e($key); ?>" class="<?php esc_attr_e($key); ?>" value="<?php esc_attr_e($setting['value']); ?>" data-default-color="<?php esc_attr_e($setting['default']); ?>" />
75
  <?php endif; ?>
76
 
77
  </fieldset>
36
 
37
  <?php if ( $setting['type'] == 'text' ) : ?>
38
 
39
+ <input class="input-text regular-input" type="text" name="<?php echo esc_attr($key); ?>" id="<?php echo esc_attr($key); ?>" value="<?php echo esc_html($setting['value'] ?: $setting['default']); ?>" placeholder="">
40
 
41
  <?php elseif ($setting['type'] == 'checkbox') : ?>
42
 
71
 
72
  <?php elseif ($setting['type'] == 'color-picker') : ?>
73
  <label for="<?php esc_attr_e($key); ?>">
74
+ <input type="text" name="<?php esc_attr_e($key); ?>" class="<?php esc_attr_e($key); ?>" value="<?php esc_attr_e($setting['value'] ?: $setting['default']); ?>" data-default-color="<?php esc_attr_e($setting['default']); ?>" />
75
  <?php endif; ?>
76
 
77
  </fieldset>
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
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: 3.5
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';
24
  const PF_HOST = 'https://www.printful.com/';
25
  const PF_API_HOST = 'https://api.printful.com/';
26
 
@@ -63,7 +63,6 @@ class Printful_Base {
63
  require_once 'includes/class-printful-admin-support.php';
64
  require_once 'includes/class-printful-size-chart-tab.php';
65
  require_once 'includes/class-printful-size-chart-tab.php';
66
- require_once 'includes/class-printful-rest-api-controller.php';
67
  require_once 'includes/class-printful-template.php';
68
  require_once 'includes/class-printful-customizer.php';
69
 
@@ -161,6 +160,8 @@ class Printful_Base {
161
 
162
  public function register_rest_routes()
163
  {
 
 
164
  $printfulRestAPIController = new Printful_REST_API_Controller();
165
  $printfulRestAPIController->register_routes();
166
  }
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.1
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: 3.6
13
  */
14
 
15
  if ( ! defined( 'ABSPATH' ) ) exit;
20
 
21
  class Printful_Base {
22
 
23
+ const VERSION = '2.1.1';
24
  const PF_HOST = 'https://www.printful.com/';
25
  const PF_API_HOST = 'https://api.printful.com/';
26
 
63
  require_once 'includes/class-printful-admin-support.php';
64
  require_once 'includes/class-printful-size-chart-tab.php';
65
  require_once 'includes/class-printful-size-chart-tab.php';
 
66
  require_once 'includes/class-printful-template.php';
67
  require_once 'includes/class-printful-customizer.php';
68
 
160
 
161
  public function register_rest_routes()
162
  {
163
+ require_once 'includes/class-printful-rest-api-controller.php';
164
+
165
  $printfulRestAPIController = new Printful_REST_API_Controller();
166
  $printfulRestAPIController->register_routes();
167
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: girts_u, kievins, kberzins
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: 5.1
6
- Stable tag: 2.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -11,7 +11,32 @@ See order statistics, automate tax settings and enable live shipping rates for y
11
 
12
  == Description ==
13
 
14
- See your order, revenue and profit statistics on WooCommerce Printful's dashboard, automate tax settings and enable live shipping rates from carriers like FedEx on your WooCommerce checkout page. These rates are identical to the list you get when you submit an order manually and are specific to the shipping address your customer provides when checking out.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
  == Installation ==
17
  1. Upload 'printful-shipping-for-woocommerce' to the '/wp-content/plugins/' directory
@@ -34,10 +59,12 @@ Go to https://www.printful.com/dashboard/store , select your WooCommerce store,
34
  3. Integration settings
35
  4. Plugin status page
36
  5. Support page
37
- 6. Shipping live rates in cart
38
 
39
  == Upgrade Notice ==
40
 
 
 
 
41
  = 2.1 =
42
  Personalization feature
43
 
@@ -115,6 +142,9 @@ First release
115
 
116
  == Changelog ==
117
 
 
 
 
118
  = 2.1 =
119
  * Personalization feature
120
 
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: 5.1
6
+ Stable tag: 2.1.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
11
 
12
  == Description ==
13
 
14
+ = Partner with the #1 print-on-demand drop shipping plugin. Over 20,000 active stores and counting! =
15
+
16
+ With Printful, you can focus on building your store. We will print, fulfill and ship the product for you. Simply upload your design, add it to your store and we will do the rest.
17
+
18
+ We have a range of over 160 products, from t-shirts, leggings, and hats to posters, mugs, and beanbags. We'll fulfill and ship every order in-house, on-demand, and in an average of 3 business days at our locations in California, North Carolina, Mexico, and Europe.
19
+
20
+ Using our plugin you also get access to automated tax settings and live shipping rates.
21
+
22
+ = How does Printful work? =
23
+
24
+ When a customer buys something from your WooCommerce store, the order is automatically imported to Printful, where we fulfill and ship it to them under your brand. You can then see your order, revenue and profit statistics on your WooCommerce dashboard.
25
+
26
+ Learn more about the WooCommerce + Printful integration [here](https://www.printful.com/landing/woocommerce-print-products-fulfillment).
27
+
28
+ = With WooCommerce + Printful, you get: =
29
+
30
+ - Control your profit: We charge you to cover production – you set your retail price, and what's left is your profit
31
+ - Automated tax settings and live shipping rates
32
+ - Free design templates: Get creative with our product generator
33
+ - Product personalization: create designs your customers customize themselves
34
+ - Warehousing & Fulfillment services: You can store your entire inventory at our warehouse, meaning we can fulfill them as well as your Print-on-demand shirts
35
+ - Stress-free shipping: Lost shipments are on us, and we offer shipping methods with tracking
36
+ - Discounted samples: Order product samples with 20% off + free shipping to select destinations
37
+ - 24/7 Customer Support
38
+
39
+ Still not convinced? Check out our [demo store](https://demo-store.myprintful.com/) to see what's possible!
40
 
41
  == Installation ==
42
  1. Upload 'printful-shipping-for-woocommerce' to the '/wp-content/plugins/' directory
59
  3. Integration settings
60
  4. Plugin status page
61
  5. Support page
 
62
 
63
  == Upgrade Notice ==
64
 
65
+ = 2.1.1 =
66
+ Improved support for WooCommerce 3.6 and other minor bug fixes
67
+
68
  = 2.1 =
69
  Personalization feature
70
 
142
 
143
  == Changelog ==
144
 
145
+ = 2.1.1 =
146
+ * Improved support for WooCommerce 3.6 and other minor bug fixes
147
+
148
  = 2.1 =
149
  * Personalization feature
150