Version Description
Added option to allow Woocommerce default rates together with Printful rates for Printful products
Download this release
Release Info
Developer | printful |
Plugin | Printful Integration for WooCommerce |
Version | 1.2.5 |
Comparing to | |
See all releases |
Code changes from version 1.2.4 to 1.2.5
- includes/class-printful-shipping.php +13 -3
- printful-shipping.php +2 -2
- readme.txt +7 -1
includes/class-printful-shipping.php
CHANGED
@@ -5,6 +5,7 @@ class Printful_Shipping extends WC_Shipping_Method
|
|
5 |
{
|
6 |
public $show_warnings = false;
|
7 |
public $calculate_tax = false;
|
|
|
8 |
private $last_error = false;
|
9 |
|
10 |
//Store whether currently processed package contains Printful products (for WC<2.6)
|
@@ -23,6 +24,7 @@ class Printful_Shipping extends WC_Shipping_Method
|
|
23 |
|
24 |
$this->enabled = $this->get_option('enabled');
|
25 |
$this->show_warnings = $this->get_option('show_warnings') == 'yes';
|
|
|
26 |
|
27 |
//Initialize shipping methods for specific package (or no package)
|
28 |
add_filter('woocommerce_load_shipping_methods', array($this, 'woocommerce_load_shipping_methods'), 10000);
|
@@ -42,6 +44,12 @@ class Printful_Shipping extends WC_Shipping_Method
|
|
42 |
'label' => __( 'Enable this shipping method', 'woocommerce' ),
|
43 |
'default' => 'no'
|
44 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
'show_warnings' => array(
|
46 |
'title' => 'Show Printful warnings',
|
47 |
'type' => 'checkbox',
|
@@ -66,8 +74,10 @@ class Printful_Shipping extends WC_Shipping_Method
|
|
66 |
if($package && !empty($package['printful'])) {
|
67 |
if($this->enabled == 'yes') {
|
68 |
$this->printful_package = true;
|
69 |
-
|
70 |
-
|
|
|
|
|
71 |
WC()->shipping()->register_shipping_method($this);
|
72 |
}
|
73 |
} else if(!$package) {
|
@@ -78,7 +88,7 @@ class Printful_Shipping extends WC_Shipping_Method
|
|
78 |
|
79 |
//Remove non-Printful methods for Printful packages on WC < 2.6
|
80 |
public function woocommerce_shipping_methods($methods) {
|
81 |
-
if($this->printful_package && version_compare(WC()->version, '2.6', '<')) {
|
82 |
//For WC < 2.6 woocommerce_shipping_methods is executed after woocommerce_load_shipping_methods
|
83 |
//So we need to clean up unnecessary methods from there
|
84 |
return array();
|
5 |
{
|
6 |
public $show_warnings = false;
|
7 |
public $calculate_tax = false;
|
8 |
+
public $override_defaults = true;
|
9 |
private $last_error = false;
|
10 |
|
11 |
//Store whether currently processed package contains Printful products (for WC<2.6)
|
24 |
|
25 |
$this->enabled = $this->get_option('enabled');
|
26 |
$this->show_warnings = $this->get_option('show_warnings') == 'yes';
|
27 |
+
$this->override_defaults = $this->get_option('override_defaults') == 'yes';
|
28 |
|
29 |
//Initialize shipping methods for specific package (or no package)
|
30 |
add_filter('woocommerce_load_shipping_methods', array($this, 'woocommerce_load_shipping_methods'), 10000);
|
44 |
'label' => __( 'Enable this shipping method', 'woocommerce' ),
|
45 |
'default' => 'no'
|
46 |
),
|
47 |
+
'override_defaults' => array(
|
48 |
+
'title' => 'Disable Woocommerce rates',
|
49 |
+
'type' => 'checkbox',
|
50 |
+
'label' => 'Disable standard Woocommerce rates for products fulfilled by Printful',
|
51 |
+
'default' => 'yes'
|
52 |
+
),
|
53 |
'show_warnings' => array(
|
54 |
'title' => 'Show Printful warnings',
|
55 |
'type' => 'checkbox',
|
74 |
if($package && !empty($package['printful'])) {
|
75 |
if($this->enabled == 'yes') {
|
76 |
$this->printful_package = true;
|
77 |
+
if($this->override_defaults) {
|
78 |
+
//Remove default methods if we process Printful package
|
79 |
+
WC()->shipping()->unregister_shipping_methods();
|
80 |
+
}
|
81 |
WC()->shipping()->register_shipping_method($this);
|
82 |
}
|
83 |
} else if(!$package) {
|
88 |
|
89 |
//Remove non-Printful methods for Printful packages on WC < 2.6
|
90 |
public function woocommerce_shipping_methods($methods) {
|
91 |
+
if($this->override_defaults && $this->printful_package && version_compare(WC()->version, '2.6', '<')) {
|
92 |
//For WC < 2.6 woocommerce_shipping_methods is executed after woocommerce_load_shipping_methods
|
93 |
//So we need to clean up unnecessary methods from there
|
94 |
return array();
|
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.
|
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.
|
20 |
|
21 |
/**
|
22 |
* Construct the plugin.
|
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.5
|
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.5';
|
20 |
|
21 |
/**
|
22 |
* Construct the plugin.
|
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.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -41,6 +41,9 @@ Go to https://www.theprintful.com/dashboard/store , select your WooCommerce stor
|
|
41 |
|
42 |
== Upgrade Notice ==
|
43 |
|
|
|
|
|
|
|
44 |
= 1.2.4 =
|
45 |
Prevent virtual products from requiring shipping rate when bought together with Printful products
|
46 |
|
@@ -76,6 +79,9 @@ First release
|
|
76 |
|
77 |
== Changelog ==
|
78 |
|
|
|
|
|
|
|
79 |
= 1.2.4 =
|
80 |
* Prevent virtual products from requiring shipping rate when bought together with Printful products
|
81 |
|
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.5
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
41 |
|
42 |
== Upgrade Notice ==
|
43 |
|
44 |
+
= 1.2.5 =
|
45 |
+
Added option to allow Woocommerce default rates together with Printful rates for Printful products
|
46 |
+
|
47 |
= 1.2.4 =
|
48 |
Prevent virtual products from requiring shipping rate when bought together with Printful products
|
49 |
|
79 |
|
80 |
== Changelog ==
|
81 |
|
82 |
+
= 1.2.5 =
|
83 |
+
* Added option to allow Woocommerce default rates together with Printful rates for Printful products
|
84 |
+
|
85 |
= 1.2.4 =
|
86 |
* Prevent virtual products from requiring shipping rate when bought together with Printful products
|
87 |
|