Version Description
- Improvement - Customized user messages when saving shipping method
- Improvement - Updated some comments to comment standards
- Improvement - Overview not showing all actions when hovering only one
- Improvement - Added ABSPATH check to each file
- Improvement - Improved code comments
- Improvement - Remove globals, use WAFS() function now
- Improvement - Zipcodes are now better detected (only integer values)
- Improvement - Load textdomains
- Improvement - Add compatibility for custom value fields
- Improvement - Add world wide state support
- Fix - No notice on shipping title in DEBUG mode
- Fix - Loading icon on sub directory websites
- Fix - Condition description didn't show sometimes
- Fix - 'Category' - 'Not equal to' error
- Fix - Showing drafts in overview
- Fix - Change option name from hide_other_shipping_when_available to hide_other_shipping
- Removed - Author from overview, who needs that?
Download this release
Release Info
Developer | sormano |
Plugin | WooCommerce Advanced Free Shipping |
Version | 1.0.3 |
Comparing to | |
See all releases |
Code changes from version 1.0.2 to 1.0.3
- assets/css/admin-style.css +9 -2
- assets/js/wafs-js.js +1 -1
- includes/admin/settings/conditions/class-wafs-condition.php +117 -45
- includes/admin/settings/conditions/condition-conditions.php +52 -46
- includes/admin/settings/conditions/condition-descriptions.php +35 -30
- includes/admin/settings/conditions/condition-operators.php +31 -28
- includes/admin/settings/conditions/condition-values.php +156 -98
- includes/admin/settings/meta-box-conditions.php +20 -20
- includes/admin/settings/meta-box-settings.php +12 -13
- includes/admin/views/conditions-table.php +29 -28
- includes/class-wafs-ajax.php +54 -32
- includes/class-wafs-match-conditions.php +434 -274
- includes/class-wafs-method.php +250 -244
- includes/class-wafs-post-type.php +180 -83
- languages/wafs-pl_PL.mo +0 -0
- languages/wafs-pl_PL.po +0 -535
- languages/{wafs-en_US.mo → woocommerce-advanced-free-shipping-en_US.mo} +0 -0
- languages/{wafs-en_US.po → woocommerce-advanced-free-shipping-en_US.po} +0 -0
- languages/woocommerce-advanced-free-shipping-es_ES.mo +0 -0
- languages/woocommerce-advanced-free-shipping-es_ES.po +317 -0
- readme.txt +24 -4
- woocommerce-advanced-free-shipping.php +201 -54
assets/css/admin-style.css
CHANGED
@@ -40,7 +40,7 @@
|
|
40 |
}
|
41 |
|
42 |
#wafs_conditions p + p {
|
43 |
-
display: none;
|
44 |
}
|
45 |
/* Description */
|
46 |
.wafs_desc {
|
@@ -104,7 +104,7 @@
|
|
104 |
}
|
105 |
|
106 |
|
107 |
-
/*
|
108 |
.add.button:before {
|
109 |
font-family: WooCommerce;
|
110 |
speak: none;
|
@@ -115,4 +115,11 @@
|
|
115 |
-webkit-font-smoothing: antialiased;
|
116 |
margin-right: 7px;
|
117 |
content: "\e007";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
}
|
40 |
}
|
41 |
|
42 |
#wafs_conditions p + p {
|
43 |
+
display: none !important;
|
44 |
}
|
45 |
/* Description */
|
46 |
.wafs_desc {
|
104 |
}
|
105 |
|
106 |
|
107 |
+
/* WooCommerce Add icon */
|
108 |
.add.button:before {
|
109 |
font-family: WooCommerce;
|
110 |
speak: none;
|
115 |
-webkit-font-smoothing: antialiased;
|
116 |
margin-right: 7px;
|
117 |
content: "\e007";
|
118 |
+
}
|
119 |
+
/* Overview row actions */
|
120 |
+
#advanced_free_shipping_shipping_methods tr .row-actions {
|
121 |
+
visibility: hidden;
|
122 |
+
}
|
123 |
+
#advanced_free_shipping_shipping_methods tr:hover > td > .row-actions {
|
124 |
+
visibility: visible !important;
|
125 |
}
|
assets/js/wafs-js.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
jQuery( function( $ ) {
|
2 |
|
3 |
-
var loading_icon = '<span class="loading-icon"><img src="
|
4 |
|
5 |
// Add condition
|
6 |
$( '#wafs_conditions' ).on( 'click', '.condition-add', function() {
|
1 |
jQuery( function( $ ) {
|
2 |
|
3 |
+
var loading_icon = '<span class="loading-icon"><img src="images/wpspin_light.gif"/></span>';
|
4 |
|
5 |
// Add condition
|
6 |
$( '#wafs_conditions' ).on( 'click', '.condition-add', function() {
|
includes/admin/settings/conditions/class-wafs-condition.php
CHANGED
@@ -1,123 +1,198 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Class
|
4 |
*
|
5 |
-
* Create a condition rule
|
6 |
*
|
7 |
-
* @class
|
8 |
* @author Jeroen Sormani
|
9 |
* @package WooCommerce Advanced Free Shipping
|
10 |
* @version 1.0.0
|
11 |
*/
|
12 |
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
public $condition;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
public $operator;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
public $value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
public $group;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
public $id;
|
20 |
|
21 |
|
22 |
/**
|
23 |
-
*
|
|
|
|
|
24 |
*/
|
25 |
public function __construct( $id = null, $group = 0, $condition = null, $operator = null, $value = null ) {
|
26 |
-
|
27 |
$this->id = $id;
|
28 |
$this->group = $group;
|
29 |
$this->condition = $condition;
|
30 |
$this->operator = $operator;
|
31 |
$this->value = $value;
|
32 |
-
|
33 |
if ( ! $id )
|
34 |
$this->id = rand();
|
35 |
-
|
36 |
$this->wafs_create_object();
|
37 |
-
|
38 |
}
|
39 |
-
|
40 |
-
|
41 |
/**
|
42 |
-
*
|
|
|
|
|
43 |
*
|
44 |
-
*
|
45 |
*/
|
46 |
public function wafs_create_object() {
|
47 |
-
|
48 |
?><div class='wafs-condition-wrap'><?php
|
49 |
|
50 |
-
do_action( 'wafs_before_condition' );
|
51 |
-
|
52 |
$this->wafs_condition_conditions();
|
53 |
$this->wafs_condition_operator();
|
54 |
$this->wafs_condition_values();
|
55 |
-
|
56 |
$this->wafs_add_condition_button();
|
57 |
$this->wafs_remove_condition_button();
|
58 |
-
|
59 |
$this->wafs_condition_description();
|
60 |
-
|
61 |
-
do_action( 'wafs_after_condition' );
|
62 |
-
|
63 |
?></div><?php
|
64 |
-
|
65 |
-
}
|
66 |
-
|
67 |
-
|
68 |
/**
|
69 |
* Condition dropdown.
|
70 |
*
|
71 |
-
* Render and load condition dropdown
|
|
|
|
|
72 |
*/
|
73 |
public function wafs_condition_conditions() {
|
74 |
|
75 |
wafs_condition_conditions( $this->id, $this->group, $this->condition );
|
76 |
-
|
77 |
}
|
78 |
-
|
79 |
|
80 |
/**
|
81 |
* Operator dropdown.
|
82 |
*
|
83 |
-
* Render and load operator dropdown
|
|
|
|
|
84 |
*/
|
85 |
public function wafs_condition_operator() {
|
86 |
-
|
87 |
wafs_condition_operator( $this->id, $this->group, $this->operator );
|
88 |
-
|
89 |
}
|
90 |
-
|
91 |
|
92 |
/**
|
93 |
* Value dropdown.
|
94 |
*
|
95 |
-
* Render and load value dropdown
|
|
|
|
|
96 |
*/
|
97 |
public function wafs_condition_values() {
|
98 |
|
99 |
wafs_condition_values( $this->id, $this->group, $this->condition, $this->value );
|
100 |
-
|
101 |
}
|
102 |
-
|
103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
?>
|
105 |
<a class='button condition-add' data-group='<?php echo $this->group; ?>' href='javascript:void(0);'>+</a>
|
106 |
<?php
|
107 |
}
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
public function wafs_remove_condition_button() {
|
110 |
?>
|
111 |
<a class='button condition-delete' href='javascript:void(0);'>-</a>
|
112 |
<?php
|
113 |
}
|
114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
public function wafs_condition_description() {
|
116 |
-
|
117 |
wafs_condition_description( $this->condition );
|
118 |
-
|
119 |
}
|
120 |
-
|
121 |
}
|
122 |
/**
|
123 |
* Load condition keys dropdown.
|
@@ -138,6 +213,3 @@ require_once plugin_dir_path( __FILE__ ) . 'condition-values.php';
|
|
138 |
* Load condition descriptions.
|
139 |
*/
|
140 |
require_once plugin_dir_path( __FILE__ ) . 'condition-descriptions.php';
|
141 |
-
|
142 |
-
|
143 |
-
?>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Class WAFS_Condition.
|
4 |
*
|
5 |
+
* Create a condition rule.
|
6 |
*
|
7 |
+
* @class WAFS_Condition
|
8 |
* @author Jeroen Sormani
|
9 |
* @package WooCommerce Advanced Free Shipping
|
10 |
* @version 1.0.0
|
11 |
*/
|
12 |
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
14 |
+
|
15 |
+
class WAFS_Condition {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Condition.
|
19 |
+
*
|
20 |
+
* @since 1.0.0
|
21 |
+
* @access public
|
22 |
+
* @var string $condition Condition slug.
|
23 |
+
*/
|
24 |
public $condition;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Operator.
|
28 |
+
*
|
29 |
+
* @since 1.0.0
|
30 |
+
* @access public
|
31 |
+
* @var string $operaor operator slug.
|
32 |
+
*/
|
33 |
public $operator;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Value.
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
* @access public
|
40 |
+
* @var string $value Condition value.
|
41 |
+
*/
|
42 |
public $value;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Group ID.
|
46 |
+
*
|
47 |
+
* @since 1.0.0
|
48 |
+
* @access public
|
49 |
+
* @var string $group Condition grou ID.
|
50 |
+
*/
|
51 |
public $group;
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Condition id.
|
55 |
+
*
|
56 |
+
* @since 1.0.0
|
57 |
+
* @access public
|
58 |
+
* @var string $id Condition ID.
|
59 |
+
*/
|
60 |
public $id;
|
61 |
|
62 |
|
63 |
/**
|
64 |
+
* Constructor.
|
65 |
+
*
|
66 |
+
* @since 1.0.0
|
67 |
*/
|
68 |
public function __construct( $id = null, $group = 0, $condition = null, $operator = null, $value = null ) {
|
69 |
+
|
70 |
$this->id = $id;
|
71 |
$this->group = $group;
|
72 |
$this->condition = $condition;
|
73 |
$this->operator = $operator;
|
74 |
$this->value = $value;
|
75 |
+
|
76 |
if ( ! $id )
|
77 |
$this->id = rand();
|
78 |
+
|
79 |
$this->wafs_create_object();
|
80 |
+
|
81 |
}
|
82 |
+
|
83 |
+
|
84 |
/**
|
85 |
+
* Condition rule.
|
86 |
+
*
|
87 |
+
* Create an condition rule object.
|
88 |
*
|
89 |
+
* @since 1.0.0
|
90 |
*/
|
91 |
public function wafs_create_object() {
|
92 |
+
|
93 |
?><div class='wafs-condition-wrap'><?php
|
94 |
|
95 |
+
do_action( 'wafs_before_condition', $this );
|
96 |
+
|
97 |
$this->wafs_condition_conditions();
|
98 |
$this->wafs_condition_operator();
|
99 |
$this->wafs_condition_values();
|
100 |
+
|
101 |
$this->wafs_add_condition_button();
|
102 |
$this->wafs_remove_condition_button();
|
103 |
+
|
104 |
$this->wafs_condition_description();
|
105 |
+
|
106 |
+
do_action( 'wafs_after_condition', $this );
|
107 |
+
|
108 |
?></div><?php
|
109 |
+
|
110 |
+
}
|
111 |
+
|
112 |
+
|
113 |
/**
|
114 |
* Condition dropdown.
|
115 |
*
|
116 |
+
* Render and load condition dropdown.
|
117 |
+
*
|
118 |
+
* @since 1.0.0
|
119 |
*/
|
120 |
public function wafs_condition_conditions() {
|
121 |
|
122 |
wafs_condition_conditions( $this->id, $this->group, $this->condition );
|
123 |
+
|
124 |
}
|
125 |
+
|
126 |
|
127 |
/**
|
128 |
* Operator dropdown.
|
129 |
*
|
130 |
+
* Render and load operator dropdown.
|
131 |
+
*
|
132 |
+
* @since 1.0.0
|
133 |
*/
|
134 |
public function wafs_condition_operator() {
|
135 |
+
|
136 |
wafs_condition_operator( $this->id, $this->group, $this->operator );
|
137 |
+
|
138 |
}
|
139 |
+
|
140 |
|
141 |
/**
|
142 |
* Value dropdown.
|
143 |
*
|
144 |
+
* Render and load value dropdown.
|
145 |
+
*
|
146 |
+
* @since 1.0.0
|
147 |
*/
|
148 |
public function wafs_condition_values() {
|
149 |
|
150 |
wafs_condition_values( $this->id, $this->group, $this->condition, $this->value );
|
151 |
+
|
152 |
}
|
153 |
+
|
154 |
+
|
155 |
+
/**
|
156 |
+
* Add button.
|
157 |
+
*
|
158 |
+
* Display a add button at the end of the condition rule.
|
159 |
+
*
|
160 |
+
* @since 1.0.0
|
161 |
+
*/
|
162 |
+
public function wafs_add_condition_button() {
|
163 |
?>
|
164 |
<a class='button condition-add' data-group='<?php echo $this->group; ?>' href='javascript:void(0);'>+</a>
|
165 |
<?php
|
166 |
}
|
167 |
+
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Remove button.
|
171 |
+
*
|
172 |
+
* Display aa remove button at the end of the condition rule.
|
173 |
+
*
|
174 |
+
* @since 1.0.0
|
175 |
+
*/
|
176 |
public function wafs_remove_condition_button() {
|
177 |
?>
|
178 |
<a class='button condition-delete' href='javascript:void(0);'>-</a>
|
179 |
<?php
|
180 |
}
|
181 |
+
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Description.
|
185 |
+
*
|
186 |
+
* Display an description at the end of the condition rule.
|
187 |
+
*
|
188 |
+
* @since 1.0.0
|
189 |
+
*/
|
190 |
public function wafs_condition_description() {
|
191 |
+
|
192 |
wafs_condition_description( $this->condition );
|
193 |
+
|
194 |
}
|
195 |
+
|
196 |
}
|
197 |
/**
|
198 |
* Load condition keys dropdown.
|
213 |
* Load condition descriptions.
|
214 |
*/
|
215 |
require_once plugin_dir_path( __FILE__ ) . 'condition-descriptions.php';
|
|
|
|
|
|
includes/admin/settings/conditions/condition-conditions.php
CHANGED
@@ -1,67 +1,73 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
$conditions = array(
|
6 |
-
__( 'Cart', '
|
7 |
-
'subtotal'
|
8 |
-
'subtotal_ex_tax'
|
9 |
-
'tax'
|
10 |
-
'quantity'
|
11 |
-
'contains_product'
|
12 |
-
'coupon'
|
|
|
|
|
13 |
),
|
14 |
-
__( 'User Details', '
|
15 |
-
'zipcode'
|
16 |
-
'city'
|
17 |
-
'state'
|
18 |
-
'country'
|
19 |
-
'role'
|
20 |
),
|
21 |
-
__( 'Product', '
|
22 |
-
'width'
|
23 |
-
'height'
|
24 |
-
'length'
|
25 |
-
'
|
26 |
-
'
|
27 |
-
'
|
28 |
-
'category' => __( 'Category', 'wafs' ),
|
29 |
),
|
30 |
);
|
31 |
-
|
32 |
$conditions = apply_filters( 'wafs_conditions', $conditions );
|
33 |
-
|
34 |
?>
|
35 |
-
|
36 |
<span class='wafs-condition-wrap wafs-condition-wrap-<?php echo $id; ?>'>
|
37 |
-
|
38 |
-
<select class='wafs-condition' data-group='<?php echo $group; ?>' data-id='<?php echo $id; ?>'
|
39 |
name='_wafs_shipping_method_conditions[<?php echo $group; ?>][<?php echo $id; ?>][condition]'>
|
40 |
-
|
41 |
-
<?php
|
42 |
foreach ( $conditions as $option_group => $values ) :
|
43 |
-
|
44 |
?><optgroup label='<?php echo $option_group; ?>'><?php
|
45 |
-
|
46 |
foreach ( $values as $key => $value ) :
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
?><option value='<?php echo $key; ?>' <?php echo $selected; ?>><?php echo $value; ?></option><?php
|
51 |
-
|
52 |
endforeach;
|
53 |
-
|
54 |
?></optgroup><?php
|
55 |
-
|
56 |
endforeach;
|
57 |
?>
|
58 |
-
|
59 |
</select>
|
60 |
-
|
61 |
-
</span>
|
62 |
-
|
63 |
-
<?php
|
64 |
-
|
65 |
-
}
|
66 |
|
67 |
-
|
|
|
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
|
4 |
+
/**
|
5 |
+
* Create condition dropdown.
|
6 |
+
*
|
7 |
+
* Set all conditions and create dropdown for it.
|
8 |
+
*
|
9 |
+
* @since 1.0.0
|
10 |
+
*
|
11 |
+
* @param mixed $id Throw in the condition ID.
|
12 |
+
* @param midex $group Condition group ID.
|
13 |
+
* @param string $current_value Current chosen slug.
|
14 |
+
*/
|
15 |
+
function wafs_condition_conditions( $id, $group = 0, $current_value = 'subtotal' ) {
|
16 |
|
17 |
$conditions = array(
|
18 |
+
__( 'Cart', 'woocommerce-advanced-free-shipping' ) => array(
|
19 |
+
'subtotal' => __( 'Subtotal', 'woocommerce-advanced-free-shipping' ),
|
20 |
+
'subtotal_ex_tax' => __( 'Subtotal ex. taxes', 'woocommerce-advanced-free-shipping' ),
|
21 |
+
'tax' => __( 'Tax', 'woocommerce-advanced-free-shipping' ),
|
22 |
+
'quantity' => __( 'Quantity', 'woocommerce-advanced-free-shipping' ),
|
23 |
+
'contains_product' => __( 'Contains product', 'woocommerce-advanced-free-shipping' ),
|
24 |
+
'coupon' => __( 'Coupon', 'woocommerce-advanced-free-shipping' ),
|
25 |
+
'weight' => __( 'Weight', 'woocommerce-advanced-free-shipping' ),
|
26 |
+
'contains_shipping_class' => __( 'Contains shipping class', 'woocommerce-advanced-free-shipping' ),
|
27 |
),
|
28 |
+
__( 'User Details', 'woocommerce-advanced-free-shipping' ) => array(
|
29 |
+
'zipcode' => __( 'Zipcode', 'woocommerce-advanced-free-shipping' ),
|
30 |
+
'city' => __( 'City', 'woocommerce-advanced-free-shipping' ),
|
31 |
+
'state' => __( 'State', 'woocommerce-advanced-free-shipping' ),
|
32 |
+
'country' => __( 'Country', 'woocommerce-advanced-free-shipping' ),
|
33 |
+
'role' => __( 'User role', 'woocommerce-advanced-free-shipping' ),
|
34 |
),
|
35 |
+
__( 'Product', 'woocommerce-advanced-free-shipping' ) => array(
|
36 |
+
'width' => __( 'Width', 'woocommerce-advanced-free-shipping' ),
|
37 |
+
'height' => __( 'Height', 'woocommerce-advanced-free-shipping' ),
|
38 |
+
'length' => __( 'Length', 'woocommerce-advanced-free-shipping' ),
|
39 |
+
'stock' => __( 'Stock', 'woocommerce-advanced-free-shipping' ),
|
40 |
+
'stock_status' => __( 'Stock status', 'woocommerce-advanced-free-shipping' ),
|
41 |
+
'category' => __( 'Category', 'woocommerce-advanced-free-shipping' ),
|
|
|
42 |
),
|
43 |
);
|
44 |
+
|
45 |
$conditions = apply_filters( 'wafs_conditions', $conditions );
|
|
|
46 |
?>
|
47 |
+
|
48 |
<span class='wafs-condition-wrap wafs-condition-wrap-<?php echo $id; ?>'>
|
49 |
+
|
50 |
+
<select class='wafs-condition' data-group='<?php echo $group; ?>' data-id='<?php echo $id; ?>'
|
51 |
name='_wafs_shipping_method_conditions[<?php echo $group; ?>][<?php echo $id; ?>][condition]'>
|
52 |
+
|
53 |
+
<?php
|
54 |
foreach ( $conditions as $option_group => $values ) :
|
55 |
+
|
56 |
?><optgroup label='<?php echo $option_group; ?>'><?php
|
57 |
+
|
58 |
foreach ( $values as $key => $value ) :
|
59 |
+
|
60 |
+
?><option value='<?php echo $key; ?>' <?php selected( $key, $current_value ); ?>><?php echo $value; ?></option><?php
|
61 |
+
|
|
|
|
|
62 |
endforeach;
|
63 |
+
|
64 |
?></optgroup><?php
|
65 |
+
|
66 |
endforeach;
|
67 |
?>
|
68 |
+
|
69 |
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
+
</span><?php
|
72 |
+
|
73 |
+
}
|
includes/admin/settings/conditions/condition-descriptions.php
CHANGED
@@ -1,44 +1,49 @@
|
|
1 |
<?php
|
|
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
function wafs_condition_description( $condition ) {
|
4 |
|
5 |
-
global $woocommerce;
|
6 |
-
|
7 |
$descriptions = array(
|
8 |
-
'state'
|
9 |
-
'weight'
|
10 |
-
'length'
|
11 |
-
'width'
|
12 |
-
'height'
|
13 |
-
'stock_status'
|
14 |
-
'
|
15 |
-
'
|
16 |
-
'
|
17 |
);
|
18 |
-
|
|
|
|
|
19 |
// Display description
|
20 |
-
if ( !isset( $descriptions[ $condition ] ) ) :
|
|
|
21 |
return;
|
22 |
endif;
|
23 |
-
|
24 |
-
|
25 |
|
26 |
<div class='description'>
|
27 |
-
|
28 |
-
<?php
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
</div>
|
35 |
-
|
36 |
-
<?php endif; ?>
|
37 |
-
|
38 |
</div>
|
39 |
-
|
40 |
-
</span
|
41 |
-
<?php
|
42 |
|
43 |
}
|
44 |
-
?>
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
|
4 |
+
/**
|
5 |
+
* Descriptions.
|
6 |
+
*
|
7 |
+
* Display a description icon + tooltip on hover.
|
8 |
+
*
|
9 |
+
* @since 1.0.0
|
10 |
+
*
|
11 |
+
* @param string $condition Condition to show description for.
|
12 |
+
*/
|
13 |
function wafs_condition_description( $condition ) {
|
14 |
|
|
|
|
|
15 |
$descriptions = array(
|
16 |
+
'state' => __( 'States must be installed in WC.', 'woocommerce-advanced-free-shipping' ),
|
17 |
+
'weight' => __( 'Weight calculated on all the cart contents', 'woocommerce-advanced-free-shipping' ),
|
18 |
+
'length' => __( 'Compared to lengthiest product in cart', 'woocommerce-advanced-free-shipping' ),
|
19 |
+
'width' => __( 'Compared to widest product in cart', 'woocommerce-advanced-free-shipping' ),
|
20 |
+
'height' => __( 'Compared to highest product in cart', 'woocommerce-advanced-free-shipping' ),
|
21 |
+
'stock_status' => __( 'All products in cart must match stock status', 'woocommerce-advanced-free-shipping' ),
|
22 |
+
'category' => __( 'All products in cart must match category', 'woocommerce-advanced-free-shipping' ),
|
23 |
+
'contains_product' => __( 'Cart must contain one of this product', 'woocommerce-advanced-free-shipping' ),
|
24 |
+
'contains_shipping_class' => __( 'Cart must contain at least one product with the selected shipping class', 'woocommerce-advanced-free-shipping' ),
|
25 |
);
|
26 |
+
|
27 |
+
$descriptions = apply_filters( 'wafs_descriptions', $descriptions );
|
28 |
+
|
29 |
// Display description
|
30 |
+
if ( ! isset( $descriptions[ $condition ] ) ) :
|
31 |
+
?><span class='wafs-description no-description'></span><?php
|
32 |
return;
|
33 |
endif;
|
34 |
+
|
35 |
+
?><span class='wafs-description <?php echo $condition; ?>-description'>
|
36 |
|
37 |
<div class='description'>
|
38 |
+
|
39 |
+
<img class='wafs_tip' src='<?php echo WC()->plugin_url(); ?>/assets/images/help.png' height='24' width='24' />
|
40 |
+
|
41 |
+
<div class='wafs_desc'>
|
42 |
+
<?php echo $descriptions[ $condition ]; ?>
|
43 |
+
</div>
|
44 |
+
|
|
|
|
|
|
|
|
|
45 |
</div>
|
46 |
+
|
47 |
+
</span><?php
|
|
|
48 |
|
49 |
}
|
|
includes/admin/settings/conditions/condition-operators.php
CHANGED
@@ -1,37 +1,40 @@
|
|
1 |
<?php
|
|
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
function wafs_condition_operator( $id, $group = 0, $current_value = '==' ) {
|
4 |
-
|
5 |
$operators = array(
|
6 |
-
'==' => __( 'Equal to', '
|
7 |
-
'!=' => __( 'Not equal to', '
|
8 |
-
'>=' => __( 'Greater or equal to', '
|
9 |
-
'<=' => __( 'Less or equal to ', '
|
10 |
);
|
11 |
-
|
12 |
$operators = apply_filters( 'wafs_operators', $operators );
|
13 |
-
|
14 |
-
?>
|
15 |
-
|
16 |
-
<span class='wafs-operator-wrap wafs-operator-wrap-<?php echo $id; ?>'>
|
17 |
-
|
18 |
<select id='' class='wafs-operator' name='_wafs_shipping_method_conditions[<?php echo $group; ?>][<?php echo $id; ?>][operator]'>
|
19 |
-
|
20 |
-
<?php
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
endforeach;
|
27 |
-
?>
|
28 |
-
|
29 |
</select>
|
30 |
-
|
31 |
-
</span>
|
32 |
-
|
33 |
-
<?php
|
34 |
-
|
35 |
-
}
|
36 |
|
37 |
-
|
|
|
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
|
4 |
+
/**
|
5 |
+
* Create operator dropdown.
|
6 |
+
*
|
7 |
+
* Set all operators and create dropdown for it.
|
8 |
+
*
|
9 |
+
* @since 1.0.0
|
10 |
+
*
|
11 |
+
* @param int $id Throw in the condition ID.
|
12 |
+
* @param int $group Condition group ID.
|
13 |
+
* @param string $current_value Current chosen slug.
|
14 |
+
*/
|
15 |
function wafs_condition_operator( $id, $group = 0, $current_value = '==' ) {
|
16 |
+
|
17 |
$operators = array(
|
18 |
+
'==' => __( 'Equal to', 'woocommerce-advanced-free-shipping' ),
|
19 |
+
'!=' => __( 'Not equal to', 'woocommerce-advanced-free-shipping' ),
|
20 |
+
'>=' => __( 'Greater or equal to', 'woocommerce-advanced-free-shipping' ),
|
21 |
+
'<=' => __( 'Less or equal to ', 'woocommerce-advanced-free-shipping' ),
|
22 |
);
|
23 |
+
|
24 |
$operators = apply_filters( 'wafs_operators', $operators );
|
25 |
+
|
26 |
+
?><span class='wafs-operator-wrap wafs-operator-wrap-<?php echo $id; ?>'>
|
27 |
+
|
|
|
|
|
28 |
<select id='' class='wafs-operator' name='_wafs_shipping_method_conditions[<?php echo $group; ?>][<?php echo $id; ?>][operator]'>
|
29 |
+
|
30 |
+
<?php foreach ( $operators as $key => $value ) :
|
31 |
+
|
32 |
+
?><option value='<?php echo $key; ?>' <?php selected( $key, $current_value ); ?>><?php echo $value; ?></option><?php
|
33 |
+
|
34 |
+
endforeach; ?>
|
35 |
+
|
|
|
|
|
|
|
36 |
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
+
</span><?php
|
39 |
+
|
40 |
+
}
|
includes/admin/settings/conditions/condition-values.php
CHANGED
@@ -1,192 +1,250 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
function wafs_condition_values( $id, $group = 0, $condition = 'subtotal', $current_value = '' ) {
|
4 |
|
5 |
global $woocommerce;
|
6 |
|
|
|
|
|
|
|
7 |
switch ( $condition ) :
|
8 |
-
|
9 |
default:
|
10 |
case 'subtotal' :
|
11 |
-
|
12 |
$values['field'] = 'number';
|
13 |
-
|
14 |
break;
|
15 |
-
|
16 |
case 'subtotal_ex_tax' :
|
17 |
-
|
18 |
$values['field'] = 'number';
|
19 |
-
|
20 |
break;
|
21 |
|
22 |
case 'tax' :
|
23 |
-
|
24 |
$values['field'] = 'number';
|
25 |
-
|
26 |
break;
|
27 |
-
|
28 |
case 'quantity' :
|
29 |
-
|
30 |
$values['field'] = 'number';
|
31 |
-
|
32 |
break;
|
33 |
-
|
34 |
case 'contains_product' :
|
35 |
-
|
36 |
$values['field'] = 'select';
|
37 |
|
38 |
$products = get_posts( array( 'posts_per_page' => '-1', 'post_type' => 'product', 'order' => 'asc', 'orderby' => 'title' ) );
|
39 |
foreach ( $products as $product ) :
|
40 |
-
$values['
|
41 |
endforeach;
|
42 |
-
|
43 |
break;
|
44 |
-
|
45 |
case 'coupon' :
|
46 |
-
|
47 |
$values['field'] = 'text';
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
break;
|
50 |
|
51 |
/**
|
52 |
* User details
|
53 |
*/
|
54 |
-
|
55 |
case 'zipcode' :
|
56 |
-
|
57 |
$values['field'] = 'text';
|
58 |
-
|
59 |
break;
|
60 |
|
61 |
case 'city' :
|
62 |
-
|
63 |
$values['field'] = 'text';
|
64 |
-
|
65 |
break;
|
66 |
-
|
67 |
case 'state' :
|
68 |
-
|
69 |
$values['field'] = 'select';
|
70 |
-
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
break;
|
73 |
|
74 |
case 'country' :
|
75 |
|
76 |
$values['field'] = 'select';
|
77 |
-
$values['
|
78 |
-
|
79 |
break;
|
80 |
-
|
81 |
case 'role' :
|
82 |
-
|
83 |
$values['field'] = 'select';
|
84 |
$roles = array_keys( get_editable_roles() );
|
85 |
-
$values['
|
86 |
-
|
87 |
break;
|
88 |
-
|
89 |
/**
|
90 |
* Product
|
91 |
*/
|
92 |
-
|
93 |
case 'width' :
|
94 |
-
|
95 |
$values['field'] = 'text';
|
96 |
-
|
97 |
break;
|
98 |
|
99 |
-
|
100 |
case 'height' :
|
101 |
-
|
102 |
$values['field'] = 'text';
|
103 |
-
|
104 |
break;
|
105 |
|
106 |
-
|
107 |
case 'length' :
|
108 |
-
|
109 |
-
$values['field'] = 'text';
|
110 |
-
|
111 |
-
break;
|
112 |
-
|
113 |
-
case 'weight' :
|
114 |
-
|
115 |
$values['field'] = 'text';
|
116 |
-
|
117 |
break;
|
118 |
|
119 |
case 'stock' :
|
120 |
-
|
121 |
$values['field'] = 'text';
|
122 |
-
|
123 |
break;
|
124 |
-
|
125 |
-
case 'stock_status' :
|
126 |
-
|
127 |
$values['field'] = 'select';
|
128 |
-
$values['
|
129 |
-
'instock' => __( 'In stock', '
|
130 |
-
'outofstock' => __( 'Out of stock', '
|
131 |
);
|
132 |
-
|
133 |
break;
|
134 |
|
135 |
case 'category' :
|
136 |
-
|
137 |
$values['field'] = 'select';
|
138 |
-
|
139 |
$categories = get_terms( 'product_cat', array( 'hide_empty' => false ) );
|
140 |
foreach ( $categories as $category ) :
|
141 |
-
$values['
|
142 |
endforeach;
|
143 |
-
|
144 |
break;
|
145 |
|
146 |
-
|
147 |
endswitch;
|
148 |
|
149 |
$values = apply_filters( 'wafs_values', $values, $condition );
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
<?php
|
155 |
switch ( $values['field'] ) :
|
156 |
-
|
157 |
case 'text' :
|
158 |
-
|
159 |
-
|
160 |
-
placeholder='<?php echo @$values['placeholder']; ?>' value='<?php echo $current_value; ?>'
|
161 |
-
|
162 |
break;
|
163 |
-
|
164 |
-
case 'number' :
|
165 |
-
|
166 |
-
|
167 |
-
min='<?php echo @$values['min']; ?>' max='<?php echo @$values['max']; ?>' placeholder='<?php echo @$values['placeholder']; ?>'
|
168 |
-
value='<?php echo $current_value; ?>'
|
169 |
-
|
170 |
break;
|
171 |
-
|
172 |
-
default :
|
173 |
case 'select' :
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
?></select><?php
|
|
|
180 |
break;
|
181 |
-
|
|
|
|
|
|
|
|
|
182 |
endswitch;
|
183 |
-
|
184 |
-
?>
|
185 |
-
|
186 |
-
</span>
|
187 |
-
|
188 |
-
<?php
|
189 |
-
|
190 |
-
}
|
191 |
|
192 |
-
|
|
|
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Create value input.
|
6 |
+
*
|
7 |
+
* Set all value and create an input field for it.
|
8 |
+
*
|
9 |
+
* @since 1.0.0
|
10 |
+
*
|
11 |
+
* @param int $id Throw in the condition ID.
|
12 |
+
* @param int $group Condition group ID.
|
13 |
+
* @param string $condition Condition where the value input is used for.
|
14 |
+
* @param string $current_value Current chosen slug.
|
15 |
+
*/
|
16 |
function wafs_condition_values( $id, $group = 0, $condition = 'subtotal', $current_value = '' ) {
|
17 |
|
18 |
global $woocommerce;
|
19 |
|
20 |
+
// Defaults
|
21 |
+
$values = array( 'placeholder' => '', 'min' => '', 'max' => '', 'field' => 'text', 'options' => array() );
|
22 |
+
|
23 |
switch ( $condition ) :
|
24 |
+
|
25 |
default:
|
26 |
case 'subtotal' :
|
27 |
+
|
28 |
$values['field'] = 'number';
|
29 |
+
|
30 |
break;
|
31 |
+
|
32 |
case 'subtotal_ex_tax' :
|
33 |
+
|
34 |
$values['field'] = 'number';
|
35 |
+
|
36 |
break;
|
37 |
|
38 |
case 'tax' :
|
39 |
+
|
40 |
$values['field'] = 'number';
|
41 |
+
|
42 |
break;
|
43 |
+
|
44 |
case 'quantity' :
|
45 |
+
|
46 |
$values['field'] = 'number';
|
47 |
+
|
48 |
break;
|
49 |
+
|
50 |
case 'contains_product' :
|
51 |
+
|
52 |
$values['field'] = 'select';
|
53 |
|
54 |
$products = get_posts( array( 'posts_per_page' => '-1', 'post_type' => 'product', 'order' => 'asc', 'orderby' => 'title' ) );
|
55 |
foreach ( $products as $product ) :
|
56 |
+
$values['options'][$product->ID ] = $product->post_title;
|
57 |
endforeach;
|
58 |
+
|
59 |
break;
|
60 |
+
|
61 |
case 'coupon' :
|
62 |
+
|
63 |
$values['field'] = 'text';
|
64 |
+
|
65 |
+
break;
|
66 |
+
|
67 |
+
case 'weight' :
|
68 |
+
|
69 |
+
$values['field'] = 'text';
|
70 |
+
|
71 |
+
break;
|
72 |
+
|
73 |
+
case 'contains_shipping_class' :
|
74 |
+
|
75 |
+
$values['field'] = 'select';
|
76 |
+
$values['options']['-1'] = __( 'No shipping class', 'woocommerce' );
|
77 |
+
|
78 |
+
// Get all shipping classes
|
79 |
+
foreach ( get_terms( 'product_shipping_class', array( 'hide_empty' => false ) ) as $shipping_class ) :
|
80 |
+
$values['options'][ $shipping_class->slug ] = $shipping_class->name;
|
81 |
+
endforeach;
|
82 |
+
|
83 |
break;
|
84 |
|
85 |
/**
|
86 |
* User details
|
87 |
*/
|
88 |
+
|
89 |
case 'zipcode' :
|
90 |
+
|
91 |
$values['field'] = 'text';
|
92 |
+
|
93 |
break;
|
94 |
|
95 |
case 'city' :
|
96 |
+
|
97 |
$values['field'] = 'text';
|
98 |
+
|
99 |
break;
|
100 |
+
|
101 |
case 'state' :
|
102 |
+
|
103 |
$values['field'] = 'select';
|
104 |
+
|
105 |
+
foreach ( $woocommerce->countries->states as $country => $states ) :
|
106 |
+
|
107 |
+
if ( empty( $states ) ) continue; // Don't show country if it has no states
|
108 |
+
if ( ! array_key_exists( $country, $woocommerce->countries->get_allowed_countries() ) ) continue; // Skip unallowed countries
|
109 |
+
|
110 |
+
foreach ( $states as $state_key => $state ) :
|
111 |
+
$country_states[ $woocommerce->countries->countries[ $country ] ][ $country . '_' . $state_key ] = $state;
|
112 |
+
endforeach;
|
113 |
+
|
114 |
+
$values['options'] = $country_states;
|
115 |
+
|
116 |
+
endforeach;
|
117 |
+
|
118 |
break;
|
119 |
|
120 |
case 'country' :
|
121 |
|
122 |
$values['field'] = 'select';
|
123 |
+
$values['options'] = $woocommerce->countries->get_allowed_countries();
|
124 |
+
|
125 |
break;
|
126 |
+
|
127 |
case 'role' :
|
128 |
+
|
129 |
$values['field'] = 'select';
|
130 |
$roles = array_keys( get_editable_roles() );
|
131 |
+
$values['options'] = array_combine( $roles, $roles );
|
132 |
+
|
133 |
break;
|
134 |
+
|
135 |
/**
|
136 |
* Product
|
137 |
*/
|
138 |
+
|
139 |
case 'width' :
|
140 |
+
|
141 |
$values['field'] = 'text';
|
142 |
+
|
143 |
break;
|
144 |
|
145 |
+
|
146 |
case 'height' :
|
147 |
+
|
148 |
$values['field'] = 'text';
|
149 |
+
|
150 |
break;
|
151 |
|
152 |
+
|
153 |
case 'length' :
|
154 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
$values['field'] = 'text';
|
156 |
+
|
157 |
break;
|
158 |
|
159 |
case 'stock' :
|
160 |
+
|
161 |
$values['field'] = 'text';
|
162 |
+
|
163 |
break;
|
164 |
+
|
165 |
+
case 'stock_status' :
|
166 |
+
|
167 |
$values['field'] = 'select';
|
168 |
+
$values['options'] = array(
|
169 |
+
'instock' => __( 'In stock', 'woocommerce-advanced-free-shipping' ),
|
170 |
+
'outofstock' => __( 'Out of stock', 'woocommerce-advanced-free-shipping' ),
|
171 |
);
|
172 |
+
|
173 |
break;
|
174 |
|
175 |
case 'category' :
|
176 |
+
|
177 |
$values['field'] = 'select';
|
178 |
+
|
179 |
$categories = get_terms( 'product_cat', array( 'hide_empty' => false ) );
|
180 |
foreach ( $categories as $category ) :
|
181 |
+
$values['options'][ $category->slug ] = $category->name;
|
182 |
endforeach;
|
183 |
+
|
184 |
break;
|
185 |
|
186 |
+
|
187 |
endswitch;
|
188 |
|
189 |
$values = apply_filters( 'wafs_values', $values, $condition );
|
190 |
+
|
191 |
+
?><span class='wafs-value-wrap wafs-value-wrap-<?php echo $id; ?>'><?php
|
192 |
+
|
|
|
|
|
193 |
switch ( $values['field'] ) :
|
194 |
+
|
195 |
case 'text' :
|
196 |
+
|
197 |
+
?><input type='text' class='wafs-value' name='_wafs_shipping_method_conditions[<?php echo $group; ?>][<?php echo $id; ?>][value]'
|
198 |
+
placeholder='<?php echo @$values['placeholder']; ?>' value='<?php echo $current_value; ?>'><?php
|
199 |
+
|
200 |
break;
|
201 |
+
|
202 |
+
case 'number' :
|
203 |
+
|
204 |
+
?><input type='text' class='wafs-value' name='_wafs_shipping_method_conditions[<?php echo $group; ?>][<?php echo $id; ?>][value]'
|
205 |
+
min='<?php echo @$values['min']; ?>' max='<?php echo @$values['max']; ?>' placeholder='<?php echo @$values['placeholder']; ?>'
|
206 |
+
value='<?php echo $current_value; ?>'><?php
|
207 |
+
|
208 |
break;
|
209 |
+
|
|
|
210 |
case 'select' :
|
211 |
+
|
212 |
+
// Backwards compatibility for extensions
|
213 |
+
@array_merge( $values['options'], $values['values'] );
|
214 |
+
?><select class='wafs-value' name='_wafs_shipping_method_conditions[<?php echo $group; ?>][<?php echo $id; ?>][value]'>
|
215 |
+
|
216 |
+
<option <?php selected( '', $current_value ); ?>><?php _e( 'Select option' , 'woocommerce-advanced-free-shipping' ); ?></option><?php
|
217 |
+
foreach ( $values['options'] as $key => $value ) :
|
218 |
+
|
219 |
+
if ( ! is_array( $value ) ) :
|
220 |
+
?><option value='<?php echo $key; ?>' <?php selected( $key, $current_value ); ?>><?php echo $value; ?></option><?php
|
221 |
+
else :
|
222 |
+
?><optgroup label='<?php echo $key ?>'><?php
|
223 |
+
foreach ( $value as $k => $v ) :
|
224 |
+
?><option value='<?php echo $k; ?>' <?php selected( $k, $current_value ); ?>><?php echo $v; ?></option><?php
|
225 |
+
endforeach;
|
226 |
+
?></optgroup><?php
|
227 |
+
|
228 |
+
endif;
|
229 |
+
|
230 |
+
endforeach;
|
231 |
+
|
232 |
+
if ( empty( $values['options'] ) ) :
|
233 |
+
?><option readonly disabled><?php
|
234 |
+
_e( 'There are no options available', 'woocommerce-advanced-free-shipping' );
|
235 |
+
?></option><?php
|
236 |
+
endif;
|
237 |
+
|
238 |
?></select><?php
|
239 |
+
|
240 |
break;
|
241 |
+
|
242 |
+
default :
|
243 |
+
do_action( 'wafs_conditino_value_field_type_' . $values['field'], $values );
|
244 |
+
break;
|
245 |
+
|
246 |
endswitch;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
|
248 |
+
?></span><?php
|
249 |
+
|
250 |
+
}
|
includes/admin/settings/meta-box-conditions.php
CHANGED
@@ -1,14 +1,16 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* WAFS meta box conditions
|
4 |
*
|
5 |
-
* Display the shipping conditions in the meta box
|
6 |
*
|
7 |
* @author Jeroen Sormani
|
8 |
* @package WooCommerce Advanced Free Shipping
|
9 |
* @version 1.0.0
|
10 |
*/
|
11 |
|
|
|
|
|
12 |
wp_nonce_field( 'wafs_conditions_meta_box', 'wafs_conditions_meta_box_nonce' );
|
13 |
|
14 |
global $post;
|
@@ -17,38 +19,36 @@ $conditions = get_post_meta( $post->ID, '_wafs_shipping_method_conditions', true
|
|
17 |
?>
|
18 |
<div class='wafs wafs_conditions wafs_meta_box wafs_conditions_meta_box'>
|
19 |
|
20 |
-
<p><strong><?php _e( 'Match all of the following rules to allow free shipping:', '
|
21 |
-
|
22 |
-
<?php
|
23 |
-
if ( !empty( $conditions ) ) :
|
24 |
|
25 |
foreach ( $conditions as $condition_group => $conditions ) :
|
26 |
-
?>
|
27 |
-
<div class='condition-group condition-group-<?php echo $condition_group; ?>' data-group='<?php echo $condition_group; ?>'>
|
28 |
|
29 |
-
|
|
|
|
|
30 |
<?php
|
31 |
foreach ( $conditions as $condition_id => $condition ) :
|
32 |
-
|
33 |
new Wafs_Condition( $condition_id, $condition_group, $condition['condition'], $condition['operator'], $condition['value'] );
|
34 |
-
|
35 |
endforeach;
|
36 |
?>
|
37 |
</div>
|
38 |
-
|
39 |
-
<p><strong><?php _e( 'Or', '
|
40 |
-
|
41 |
endforeach;
|
42 |
-
|
43 |
else :
|
44 |
-
|
45 |
?><div class='condition-group condition-group-0' data-group='0'><?php
|
46 |
new Wafs_Condition();
|
47 |
?></div><?php
|
48 |
-
|
49 |
-
endif;
|
50 |
-
?>
|
51 |
|
52 |
</div>
|
53 |
|
54 |
-
<a class='button condition-group-add' href='javascript:void(0);'><?php _e( 'Add \'Or\' group', '
|
1 |
<?php
|
2 |
/**
|
3 |
+
* WAFS meta box conditions.
|
4 |
*
|
5 |
+
* Display the shipping conditions in the meta box.
|
6 |
*
|
7 |
* @author Jeroen Sormani
|
8 |
* @package WooCommerce Advanced Free Shipping
|
9 |
* @version 1.0.0
|
10 |
*/
|
11 |
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
13 |
+
|
14 |
wp_nonce_field( 'wafs_conditions_meta_box', 'wafs_conditions_meta_box_nonce' );
|
15 |
|
16 |
global $post;
|
19 |
?>
|
20 |
<div class='wafs wafs_conditions wafs_meta_box wafs_conditions_meta_box'>
|
21 |
|
22 |
+
<p><strong><?php _e( 'Match all of the following rules to allow free shipping:', 'woocommerce-advanced-free-shipping' ); ?></strong></p>
|
23 |
+
|
24 |
+
<?php if ( !empty( $conditions ) ) :
|
|
|
25 |
|
26 |
foreach ( $conditions as $condition_group => $conditions ) :
|
|
|
|
|
27 |
|
28 |
+
?><div class='condition-group condition-group-<?php echo $condition_group; ?>' data-group='<?php echo $condition_group; ?>'>
|
29 |
+
|
30 |
+
<p class='or_match'><?php _e( 'Or match all of the following rules to allow free shipping:', 'woocommerce-advanced-free-shipping' );?></p>
|
31 |
<?php
|
32 |
foreach ( $conditions as $condition_id => $condition ) :
|
33 |
+
|
34 |
new Wafs_Condition( $condition_id, $condition_group, $condition['condition'], $condition['operator'], $condition['value'] );
|
35 |
+
|
36 |
endforeach;
|
37 |
?>
|
38 |
</div>
|
39 |
+
|
40 |
+
<p><strong><?php _e( 'Or', 'woocommerce-advanced-free-shipping' ); ?></strong></p><?php
|
41 |
+
|
42 |
endforeach;
|
43 |
+
|
44 |
else :
|
45 |
+
|
46 |
?><div class='condition-group condition-group-0' data-group='0'><?php
|
47 |
new Wafs_Condition();
|
48 |
?></div><?php
|
49 |
+
|
50 |
+
endif; ?>
|
|
|
51 |
|
52 |
</div>
|
53 |
|
54 |
+
<a class='button condition-group-add' href='javascript:void(0);'><?php _e( 'Add \'Or\' group', 'woocommerce-advanced-free-shipping' ); ?></a>
|
includes/admin/settings/meta-box-settings.php
CHANGED
@@ -1,31 +1,30 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* WAFS meta box settings
|
4 |
*
|
5 |
-
* Display the shipping settings in the meta box
|
6 |
*
|
7 |
* @author Jeroen Sormani
|
8 |
* @package WooCommerce Advanced Free Shipping
|
9 |
* @version 1.0.0
|
10 |
*/
|
11 |
|
|
|
|
|
12 |
wp_nonce_field( 'wafs_settings_meta_box', 'wafs_settings_meta_box_nonce' );
|
13 |
|
14 |
global $post;
|
15 |
-
$settings = get_post_meta( $post->ID, '_wafs_shipping_method' );
|
16 |
?>
|
17 |
<div class='wafs wafs_settings wafs_meta_box wafs_settings_meta_box'>
|
18 |
-
|
19 |
<p class='wafs-option'>
|
20 |
-
|
21 |
-
<label for='shipping_title'><?php _e( 'Shipping title', '
|
22 |
-
<input type='text' class='' id='shipping_title' name='_wafs_shipping_method[shipping_title]'
|
23 |
-
value='<?php echo @$settings[
|
24 |
-
|
25 |
</p>
|
26 |
-
|
27 |
|
28 |
-
</div>
|
29 |
-
<?php
|
30 |
|
31 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* WAFS meta box settings.
|
4 |
*
|
5 |
+
* Display the shipping settings in the meta box.
|
6 |
*
|
7 |
* @author Jeroen Sormani
|
8 |
* @package WooCommerce Advanced Free Shipping
|
9 |
* @version 1.0.0
|
10 |
*/
|
11 |
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
13 |
+
|
14 |
wp_nonce_field( 'wafs_settings_meta_box', 'wafs_settings_meta_box_nonce' );
|
15 |
|
16 |
global $post;
|
17 |
+
$settings = get_post_meta( $post->ID, '_wafs_shipping_method', true );
|
18 |
?>
|
19 |
<div class='wafs wafs_settings wafs_meta_box wafs_settings_meta_box'>
|
20 |
+
|
21 |
<p class='wafs-option'>
|
22 |
+
|
23 |
+
<label for='shipping_title'><?php _e( 'Shipping title', 'woocommerce-advanced-free-shipping' ); ?></label>
|
24 |
+
<input type='text' class='' id='shipping_title' name='_wafs_shipping_method[shipping_title]'
|
25 |
+
value='<?php echo @$settings['shipping_title']; ?>' placeholder='<?php _e( 'e.g. Free Shipping', 'woocommerce-advanced-free-shipping' ); ?>'>
|
26 |
+
|
27 |
</p>
|
|
|
28 |
|
|
|
|
|
29 |
|
30 |
+
</div>
|
includes/admin/views/conditions-table.php
CHANGED
@@ -1,79 +1,80 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Conditions table
|
4 |
*
|
5 |
-
* Display table with all the user configured Free shipping conditions
|
6 |
*
|
7 |
* @author Jeroen Sormani
|
8 |
* @package WooCommerce Advanced Free Shipping
|
9 |
* @version 1.0.0
|
10 |
*/
|
11 |
-
|
|
|
|
|
|
|
12 |
?>
|
13 |
<tr valign="top">
|
14 |
<th scope="row" class="titledesc">
|
15 |
-
<?php _e( 'Method conditions', '
|
16 |
-
|
17 |
</th>
|
18 |
-
<td class="forminp" id="<?php echo $this->id; ?>
|
19 |
|
20 |
<table class='wp-list-table wafs-table widefat'>
|
21 |
<thead>
|
22 |
<tr>
|
23 |
-
<th style='padding-left: 10px;'><?php _e( 'Title', '
|
24 |
-
<th><?php _e( 'Shipping title', '
|
25 |
-
<th><?php _e( 'Condition groups', '
|
26 |
-
<th><?php _e( 'Author', 'wafs' ); ?></th>
|
27 |
</tr>
|
28 |
</thead>
|
29 |
<tbody>
|
30 |
<?php
|
31 |
foreach ( $method_conditions as $method_condition ) :
|
|
|
32 |
$method_details = get_post_meta( $method_condition->ID, '_wafs_shipping_method', true );
|
33 |
$conditions = get_post_meta( $method_condition->ID, '_wafs_shipping_method_conditions', true );
|
34 |
-
|
35 |
-
|
36 |
<td>
|
37 |
<strong>
|
38 |
-
<a href='<?php echo get_edit_post_link( $method_condition->ID ); ?>' class='row-title' title='<?php _e( 'Edit Method', '
|
39 |
-
<?php echo $method_condition->post_title; echo empty( $method_condition->post_title) ? __( 'Untitled', '
|
40 |
</a>
|
41 |
</strong>
|
42 |
<div class='row-actions'>
|
43 |
<span class='edit'>
|
44 |
-
<a href='<?php echo get_edit_post_link( $method_condition->ID ); ?>' title='<?php _e( 'Edit Method', '
|
45 |
-
<?php _e( 'Edit', '
|
46 |
</a>
|
47 |
|
|
48 |
</span>
|
49 |
<span class='trash'>
|
50 |
-
<a href='<?php echo get_delete_post_link( $method_condition->ID ); ?>' title='<?php _e( 'Delete Method', '
|
51 |
-
<?php _e( 'Delete', '
|
52 |
</a>
|
53 |
</span>
|
54 |
</div>
|
55 |
</td>
|
56 |
-
<td><?php echo empty( $method_details['shipping_title'] ) ? __( 'Free Shipping', '
|
57 |
<td><?php echo count( $conditions ); ?></td>
|
58 |
-
<td><?php echo get_the_author_meta( 'display_name', $method_condition->post_author ); ?></a>
|
59 |
</td>
|
60 |
-
</tr
|
61 |
-
|
62 |
endforeach;
|
63 |
-
|
64 |
if ( empty( $method_conditions ) ) :
|
65 |
?>
|
66 |
<tr>
|
67 |
-
<td colspan='2'><?php _e( 'There are no Free Shipping
|
68 |
</tr>
|
69 |
-
<?php
|
70 |
-
|
71 |
-
?>
|
72 |
</tbody>
|
73 |
<tfoot>
|
74 |
<tr>
|
75 |
<th colspan='4' style='padding-left: 10px;'>
|
76 |
-
<a href='<?php echo admin_url( 'post-new.php?post_type=wafs' ); ?>' class='add button'><?php _e( 'Add Free Shipping Method', '
|
77 |
</th>
|
78 |
</tr>
|
79 |
</tfoot>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Conditions table.
|
4 |
*
|
5 |
+
* Display table with all the user configured Free shipping conditions.
|
6 |
*
|
7 |
* @author Jeroen Sormani
|
8 |
* @package WooCommerce Advanced Free Shipping
|
9 |
* @version 1.0.0
|
10 |
*/
|
11 |
+
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
13 |
+
|
14 |
+
$method_conditions = get_posts( array( 'posts_per_page' => '-1', 'post_type' => 'wafs', 'post_status' => array( 'draft', 'publish' ) ) );
|
15 |
?>
|
16 |
<tr valign="top">
|
17 |
<th scope="row" class="titledesc">
|
18 |
+
<?php _e( 'Method conditions', 'woocommerce-advanced-free-shipping' ); ?>:<br />
|
19 |
+
<!-- <small>Read more</small> -->
|
20 |
</th>
|
21 |
+
<td class="forminp" id="<?php echo $this->id; ?>_shipping_methods">
|
22 |
|
23 |
<table class='wp-list-table wafs-table widefat'>
|
24 |
<thead>
|
25 |
<tr>
|
26 |
+
<th style='padding-left: 10px;'><?php _e( 'Title', 'woocommerce-advanced-free-shipping' ); ?></th>
|
27 |
+
<th style='padding-left: 10px;'><?php _e( 'Shipping title', 'woocommerce-advanced-free-shipping' ); ?></th>
|
28 |
+
<th style='padding-left: 10px;'><?php _e( 'Condition groups', 'woocommerce-advanced-free-shipping' ); ?></th>
|
|
|
29 |
</tr>
|
30 |
</thead>
|
31 |
<tbody>
|
32 |
<?php
|
33 |
foreach ( $method_conditions as $method_condition ) :
|
34 |
+
|
35 |
$method_details = get_post_meta( $method_condition->ID, '_wafs_shipping_method', true );
|
36 |
$conditions = get_post_meta( $method_condition->ID, '_wafs_shipping_method_conditions', true );
|
37 |
+
|
38 |
+
?><tr>
|
39 |
<td>
|
40 |
<strong>
|
41 |
+
<a href='<?php echo get_edit_post_link( $method_condition->ID ); ?>' class='row-title' title='<?php _e( 'Edit Method', 'woocommerce-advanced-free-shipping' ); ?>'>
|
42 |
+
<?php echo $method_condition->post_title; echo empty( $method_condition->post_title) ? __( 'Untitled', 'woocommerce-advanced-free-shipping' ) : null; ?>
|
43 |
</a>
|
44 |
</strong>
|
45 |
<div class='row-actions'>
|
46 |
<span class='edit'>
|
47 |
+
<a href='<?php echo get_edit_post_link( $method_condition->ID ); ?>' title='<?php _e( 'Edit Method', 'woocommerce-advanced-free-shipping' ); ?>'>
|
48 |
+
<?php _e( 'Edit', 'woocommerce-advanced-free-shipping' ); ?>
|
49 |
</a>
|
50 |
|
|
51 |
</span>
|
52 |
<span class='trash'>
|
53 |
+
<a href='<?php echo get_delete_post_link( $method_condition->ID ); ?>' title='<?php _e( 'Delete Method', 'woocommerce-advanced-free-shipping' ); ?>'>
|
54 |
+
<?php _e( 'Delete', 'woocommerce-advanced-free-shipping' ); ?>
|
55 |
</a>
|
56 |
</span>
|
57 |
</div>
|
58 |
</td>
|
59 |
+
<td><?php echo empty( $method_details['shipping_title'] ) ? __( 'Free Shipping', 'woocommerce-advanced-free-shipping') : $method_details['shipping_title']; ?></td>
|
60 |
<td><?php echo count( $conditions ); ?></td>
|
|
|
61 |
</td>
|
62 |
+
</tr><?php
|
63 |
+
|
64 |
endforeach;
|
65 |
+
|
66 |
if ( empty( $method_conditions ) ) :
|
67 |
?>
|
68 |
<tr>
|
69 |
+
<td colspan='2'><?php _e( 'There are no Free Shipping methods. Yet...', 'woocommerce-advanced-free-shipping' ); ?></td>
|
70 |
</tr>
|
71 |
+
<?php endif; ?>
|
72 |
+
|
|
|
73 |
</tbody>
|
74 |
<tfoot>
|
75 |
<tr>
|
76 |
<th colspan='4' style='padding-left: 10px;'>
|
77 |
+
<a href='<?php echo admin_url( 'post-new.php?post_type=wafs' ); ?>' class='add button'><?php _e( 'Add Free Shipping Method', 'woocommerce-advanced-free-shipping' ); ?></a>
|
78 |
</th>
|
79 |
</tr>
|
80 |
</tfoot>
|
includes/class-wafs-ajax.php
CHANGED
@@ -1,85 +1,107 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
-
* Class
|
4 |
*
|
5 |
-
* Initialize the WAFS post type
|
6 |
*
|
7 |
-
* @class
|
8 |
* @author Jeroen Sormani
|
9 |
* @package WooCommerce Advanced Free Shipping
|
10 |
* @version 1.0.0
|
11 |
*/
|
12 |
-
class
|
13 |
|
14 |
|
15 |
-
|
|
|
16 |
*
|
17 |
* Add ajax actions in order to work.
|
|
|
|
|
18 |
*/
|
19 |
public function __construct() {
|
20 |
-
|
21 |
// Add elements
|
22 |
add_action( 'wp_ajax_wafs_add_condition', array( $this, 'wafs_add_condition' ) );
|
23 |
add_action( 'wp_ajax_wafs_add_condition_group', array( $this, 'wafs_add_condition_group' ) );
|
24 |
-
|
25 |
// Update elements
|
26 |
add_action( 'wp_ajax_wafs_update_condition_value', array( $this, 'wafs_update_condition_value' ) );
|
27 |
add_action( 'wp_ajax_wafs_update_condition_description', array( $this, 'wafs_update_condition_description' ) );
|
28 |
-
|
29 |
}
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
33 |
*/
|
34 |
public function wafs_add_condition() {
|
35 |
|
36 |
-
new
|
37 |
die();
|
38 |
-
|
39 |
}
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
42 |
* Render new condition group.
|
|
|
|
|
43 |
*/
|
44 |
public function wafs_add_condition_group() {
|
45 |
?>
|
46 |
<div class='condition-group condition-group-<?php echo $_POST['group']; ?>' data-group='<?php echo $_POST['group']; ?>'>
|
47 |
-
|
48 |
-
<p class='or_match'><?php _e( 'Or match all of the following rules to allow free shipping:', '
|
49 |
-
<?php
|
50 |
-
new
|
51 |
?>
|
52 |
|
53 |
</div>
|
54 |
|
55 |
-
<p><strong><?php _e( 'Or', '
|
56 |
-
|
57 |
<?php
|
58 |
die();
|
59 |
}
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
62 |
*
|
63 |
-
*
|
64 |
*/
|
65 |
public function wafs_update_condition_value() {
|
66 |
|
67 |
wafs_condition_values( $_POST['id'], $_POST['group'], $_POST['condition'] );
|
68 |
die();
|
69 |
-
|
70 |
}
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
|
|
73 |
*
|
74 |
-
*
|
75 |
*/
|
76 |
public function wafs_update_condition_description() {
|
77 |
-
|
78 |
wafs_condition_description( $_POST['condition'] );
|
79 |
die();
|
80 |
-
|
81 |
}
|
82 |
-
|
83 |
|
84 |
}
|
85 |
-
new
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
/**
|
4 |
+
* Class WAFS_Ajax.
|
5 |
*
|
6 |
+
* Initialize the WAFS post type.
|
7 |
*
|
8 |
+
* @class WAFS_Ajax
|
9 |
* @author Jeroen Sormani
|
10 |
* @package WooCommerce Advanced Free Shipping
|
11 |
* @version 1.0.0
|
12 |
*/
|
13 |
+
class WAFS_Ajax {
|
14 |
|
15 |
|
16 |
+
/**
|
17 |
+
* Constructor.
|
18 |
*
|
19 |
* Add ajax actions in order to work.
|
20 |
+
*
|
21 |
+
* @since 1.0.0
|
22 |
*/
|
23 |
public function __construct() {
|
24 |
+
|
25 |
// Add elements
|
26 |
add_action( 'wp_ajax_wafs_add_condition', array( $this, 'wafs_add_condition' ) );
|
27 |
add_action( 'wp_ajax_wafs_add_condition_group', array( $this, 'wafs_add_condition_group' ) );
|
28 |
+
|
29 |
// Update elements
|
30 |
add_action( 'wp_ajax_wafs_update_condition_value', array( $this, 'wafs_update_condition_value' ) );
|
31 |
add_action( 'wp_ajax_wafs_update_condition_description', array( $this, 'wafs_update_condition_description' ) );
|
32 |
+
|
33 |
}
|
34 |
+
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Add condition.
|
38 |
+
*
|
39 |
+
* Create a new WAS_Condition class and render.
|
40 |
+
*
|
41 |
+
* @since 1.0.0
|
42 |
*/
|
43 |
public function wafs_add_condition() {
|
44 |
|
45 |
+
new WAFS_Condition( null, $_POST['group'] );
|
46 |
die();
|
47 |
+
|
48 |
}
|
49 |
+
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Condition group.
|
53 |
+
*
|
54 |
* Render new condition group.
|
55 |
+
*
|
56 |
+
* @since 1.0.0
|
57 |
*/
|
58 |
public function wafs_add_condition_group() {
|
59 |
?>
|
60 |
<div class='condition-group condition-group-<?php echo $_POST['group']; ?>' data-group='<?php echo $_POST['group']; ?>'>
|
61 |
+
|
62 |
+
<p class='or_match'><?php _e( 'Or match all of the following rules to allow free shipping:', 'woocommerce-advanced-free-shipping' );?></p>
|
63 |
+
<?php
|
64 |
+
new WAFS_Condition( null, $_POST['group'] );
|
65 |
?>
|
66 |
|
67 |
</div>
|
68 |
|
69 |
+
<p><strong><?php _e( 'Or', 'woocommerce-advanced-free-shipping' ); ?></strong></p>
|
70 |
+
|
71 |
<?php
|
72 |
die();
|
73 |
}
|
74 |
+
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Update values.
|
78 |
+
*
|
79 |
+
* Retreive and render the new condition values according to the condition key.
|
80 |
*
|
81 |
+
* @since 1.0.0
|
82 |
*/
|
83 |
public function wafs_update_condition_value() {
|
84 |
|
85 |
wafs_condition_values( $_POST['id'], $_POST['group'], $_POST['condition'] );
|
86 |
die();
|
87 |
+
|
88 |
}
|
89 |
+
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Update description.
|
93 |
+
*
|
94 |
+
* Render the corresponding description for the condition key.
|
95 |
*
|
96 |
+
* @since 1.0.0
|
97 |
*/
|
98 |
public function wafs_update_condition_description() {
|
99 |
+
|
100 |
wafs_condition_description( $_POST['condition'] );
|
101 |
die();
|
102 |
+
|
103 |
}
|
104 |
+
|
105 |
|
106 |
}
|
107 |
+
new WAFS_Ajax();
|
includes/class-wafs-match-conditions.php
CHANGED
@@ -1,61 +1,70 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
*
|
6 |
*
|
7 |
-
*
|
8 |
-
*
|
9 |
-
*
|
10 |
-
*
|
11 |
*/
|
12 |
-
class
|
13 |
|
14 |
|
15 |
/**
|
16 |
-
*
|
17 |
-
|
|
|
18 |
public function __construct() {
|
19 |
-
|
20 |
global $woocommerce;
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
}
|
44 |
|
45 |
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
47 |
*
|
48 |
-
* @
|
49 |
-
*
|
50 |
-
* @param
|
51 |
-
* @
|
|
|
|
|
52 |
*/
|
53 |
public function wafs_match_condition_subtotal( $match, $operator, $value ) {
|
54 |
|
55 |
global $woocommerce;
|
56 |
|
57 |
if ( ! isset( $woocommerce->cart ) ) return;
|
58 |
-
|
59 |
if ( '==' == $operator ) :
|
60 |
$match = ( $woocommerce->cart->subtotal == $value );
|
61 |
elseif ( '!=' == $operator ) :
|
@@ -65,23 +74,30 @@ class Wafs_Match_Conditions {
|
|
65 |
elseif ( '<=' == $operator ) :
|
66 |
$match = ( $woocommerce->cart->subtotal <= $value );
|
67 |
endif;
|
68 |
-
|
69 |
return $match;
|
70 |
-
|
71 |
}
|
72 |
|
73 |
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
75 |
*
|
76 |
-
* @
|
77 |
-
*
|
78 |
-
* @param
|
79 |
-
* @
|
|
|
|
|
80 |
*/
|
81 |
public function wafs_match_condition_subtotal_ex_tax( $match, $operator, $value ) {
|
82 |
|
83 |
global $woocommerce;
|
84 |
-
|
85 |
if ( ! isset( $woocommerce->cart ) ) return;
|
86 |
|
87 |
if ( '==' == $operator ) :
|
@@ -93,23 +109,30 @@ class Wafs_Match_Conditions {
|
|
93 |
elseif ( '<=' == $operator ) :
|
94 |
$match = ( $woocommerce->cart->subtotal_ex_tax <= $value );
|
95 |
endif;
|
96 |
-
|
97 |
return $match;
|
98 |
-
|
99 |
}
|
100 |
-
|
101 |
|
102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
*
|
104 |
-
* @
|
105 |
-
*
|
106 |
-
* @param
|
107 |
-
* @
|
|
|
|
|
108 |
*/
|
109 |
public function wafs_match_condition_tax( $match, $operator, $value ) {
|
110 |
|
111 |
global $woocommerce;
|
112 |
-
|
113 |
if ( ! isset( $woocommerce->cart ) ) return;
|
114 |
|
115 |
$taxes = array_sum( (array) $woocommerce->cart->taxes );
|
@@ -123,25 +146,33 @@ class Wafs_Match_Conditions {
|
|
123 |
elseif ( '<=' == $operator ) :
|
124 |
$match = ( $taxes <= $value );
|
125 |
endif;
|
126 |
-
|
127 |
return $match;
|
128 |
-
|
129 |
}
|
130 |
-
|
131 |
|
132 |
-
|
|
|
|
|
|
|
|
|
|
|
133 |
*
|
134 |
-
* @
|
135 |
-
*
|
136 |
-
* @
|
137 |
-
*
|
|
|
|
|
|
|
|
|
138 |
*/
|
139 |
public function wafs_match_condition_quantity( $match, $operator, $value ) {
|
140 |
|
141 |
global $woocommerce;
|
142 |
-
|
143 |
if ( ! isset( $woocommerce->cart ) ) return;
|
144 |
-
|
145 |
if ( '==' == $operator ) :
|
146 |
$match = ( $woocommerce->cart->cart_contents_count == $value );
|
147 |
elseif ( '!=' == $operator ) :
|
@@ -151,192 +182,317 @@ class Wafs_Match_Conditions {
|
|
151 |
elseif ( '<=' == $operator ) :
|
152 |
$match = ( $woocommerce->cart->cart_contents_count <= $value );
|
153 |
endif;
|
154 |
-
|
155 |
return $match;
|
156 |
-
|
157 |
}
|
158 |
-
|
159 |
|
160 |
-
|
|
|
|
|
161 |
*
|
162 |
-
*
|
163 |
-
*
|
164 |
-
* @
|
165 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
*/
|
167 |
public function wafs_match_condition_contains_product( $match, $operator, $value ) {
|
168 |
|
169 |
global $woocommerce;
|
170 |
-
|
171 |
if ( ! isset( $woocommerce->cart ) || empty( $woocommerce->cart->cart_contents ) ) return;
|
172 |
-
|
173 |
foreach ( $woocommerce->cart->cart_contents as $product ) :
|
174 |
$product_ids[] = $product['product_id'];
|
175 |
endforeach;
|
176 |
-
|
177 |
if ( '==' == $operator ) :
|
178 |
$match = ( in_array( $value, $product_ids ) );
|
179 |
elseif ( '!=' == $operator ) :
|
180 |
$match = ( ! in_array( $value, $product_ids ) );
|
181 |
endif;
|
182 |
-
|
183 |
return $match;
|
184 |
-
|
185 |
}
|
186 |
-
|
187 |
|
188 |
-
|
|
|
|
|
|
|
|
|
189 |
*
|
190 |
-
* @
|
191 |
-
*
|
192 |
-
* @
|
193 |
-
*
|
|
|
|
|
|
|
|
|
194 |
*/
|
195 |
public function wafs_match_condition_coupon( $match, $operator, $value ) {
|
196 |
|
197 |
global $woocommerce;
|
198 |
-
|
199 |
if ( ! isset( $woocommerce->cart ) ) return;
|
200 |
-
|
201 |
if ( '==' == $operator ) :
|
202 |
$match = ( in_array( $value, $woocommerce->cart->applied_coupons ) );
|
203 |
elseif ( '!=' == $operator ) :
|
204 |
$match = ( ! in_array( $value, $woocommerce->cart->applied_coupons ) );
|
205 |
endif;
|
206 |
-
|
207 |
return $match;
|
208 |
-
|
209 |
}
|
210 |
|
211 |
-
|
212 |
-
/***************************
|
213 |
-
*
|
214 |
-
* User details
|
215 |
-
*
|
216 |
-
***************************
|
217 |
-
*/
|
218 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
|
220 |
-
|
|
|
|
|
|
|
|
|
221 |
*
|
222 |
-
*
|
223 |
*
|
224 |
-
* @
|
225 |
-
*
|
226 |
-
* @param
|
227 |
-
* @
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
*/
|
229 |
public function wafs_match_condition_zipcode( $match, $operator, $value ) {
|
230 |
|
231 |
global $woocommerce;
|
232 |
-
|
233 |
-
if ( !isset( $woocommerce->customer ) ) return;
|
234 |
|
235 |
if ( '==' == $operator ) :
|
236 |
|
237 |
-
if ( preg_match( '/\,
|
238 |
-
$match = ( in_array( $woocommerce->customer->get_shipping_postcode(), explode( ',', $value ) ) );
|
239 |
else :
|
240 |
-
$match = ( $woocommerce->customer->get_shipping_postcode() == $value );
|
241 |
endif;
|
242 |
|
243 |
elseif ( '!=' == $operator ) :
|
244 |
|
245 |
-
if ( preg_match( '
|
246 |
-
$match = ( !in_array( $woocommerce->customer->get_shipping_postcode(), explode( ',', $value ) ) );
|
247 |
else :
|
248 |
-
$match = ( $woocommerce->customer->get_shipping_postcode() != $value );
|
249 |
endif;
|
250 |
|
251 |
elseif ( '>=' == $operator ) :
|
252 |
-
$match = ( $woocommerce->customer->get_shipping_postcode() >= $value );
|
253 |
elseif ( '<=' == $operator ) :
|
254 |
-
$match = ( $woocommerce->customer->get_shipping_postcode() <= $value );
|
255 |
endif;
|
256 |
-
|
257 |
return $match;
|
258 |
-
|
259 |
}
|
260 |
|
261 |
|
262 |
-
|
|
|
|
|
|
|
263 |
*
|
264 |
-
* @
|
265 |
-
*
|
266 |
-
* @
|
267 |
-
*
|
|
|
|
|
|
|
|
|
268 |
*/
|
269 |
public function wafs_match_condition_city( $match, $operator, $value ) {
|
270 |
|
271 |
global $woocommerce;
|
272 |
-
|
273 |
if ( ! isset( $woocommerce->customer ) ) return;
|
274 |
-
|
275 |
if ( '==' == $operator ) :
|
276 |
$match = ( preg_match( "/^$value$/i", $woocommerce->customer->get_shipping_city() ) );
|
277 |
elseif ( '!=' == $operator ) :
|
278 |
$match = ( ! preg_match( "/^$value$/i", $woocommerce->customer->get_shipping_city() ) );
|
279 |
endif;
|
280 |
-
|
281 |
return $match;
|
282 |
-
|
283 |
}
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
*
|
288 |
-
*
|
289 |
-
*
|
290 |
-
*
|
291 |
-
* @
|
292 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
293 |
public function wafs_match_condition_state( $match, $operator, $value ) {
|
294 |
|
295 |
global $woocommerce;
|
296 |
-
|
297 |
if ( ! isset( $woocommerce->customer ) ) return;
|
298 |
-
|
|
|
|
|
299 |
if ( '==' == $operator ) :
|
300 |
-
$match = ( $
|
301 |
elseif ( '!=' == $operator ) :
|
302 |
-
$match = ( $
|
303 |
endif;
|
304 |
-
|
305 |
return $match;
|
306 |
-
|
307 |
}
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
*
|
312 |
-
*
|
313 |
-
*
|
314 |
-
*
|
315 |
-
* @
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
316 |
*/
|
317 |
public function wafs_match_condition_country( $match, $operator, $value ) {
|
318 |
|
319 |
global $woocommerce;
|
320 |
-
|
321 |
if ( ! isset( $woocommerce->customer ) ) return;
|
322 |
-
|
323 |
if ( '==' == $operator ) :
|
324 |
$match = ( preg_match( "/^$value$/i", $woocommerce->customer->get_shipping_country() ) );
|
325 |
elseif ( '!=' == $operator ) :
|
326 |
$match = ( ! preg_match( "/^$value$/i", $woocommerce->customer->get_shipping_country() ) );
|
327 |
endif;
|
328 |
-
|
329 |
return $match;
|
330 |
-
|
331 |
}
|
332 |
-
|
333 |
|
334 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
335 |
*
|
336 |
-
* @
|
337 |
-
* @
|
338 |
-
*
|
339 |
-
* @
|
|
|
|
|
|
|
340 |
*/
|
341 |
public function wafs_match_condition_role( $match, $operator, $value ) {
|
342 |
|
@@ -347,38 +503,40 @@ class Wafs_Match_Conditions {
|
|
347 |
elseif ( '!=' == $operator ) :
|
348 |
$match = ( ! array_key_exists( $value, $current_user->caps ) );
|
349 |
endif;
|
350 |
-
|
351 |
return $match;
|
352 |
-
|
353 |
}
|
354 |
-
|
355 |
|
356 |
-
/***************************
|
357 |
-
*
|
358 |
-
* Product
|
359 |
-
*
|
360 |
-
***************************
|
361 |
-
*/
|
362 |
|
|
|
|
|
|
|
363 |
|
364 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
365 |
*
|
366 |
-
*
|
367 |
*
|
368 |
-
* @param
|
369 |
-
* @param
|
370 |
-
* @param
|
371 |
-
* @return
|
372 |
*/
|
373 |
public function wafs_match_condition_width( $match, $operator, $value ) {
|
374 |
|
375 |
global $woocommerce;
|
376 |
-
|
377 |
if ( ! isset( $woocommerce->cart ) || empty( $woocommerce->cart->cart_contents ) ) return;
|
378 |
-
|
379 |
foreach ( $woocommerce->cart->cart_contents as $product ) :
|
380 |
|
381 |
-
if ( true == $product['data']->variation_has_width ) :
|
382 |
$width[] = ( get_post_meta( $product['data']->variation_id, '_width', true ) );
|
383 |
else :
|
384 |
$width[] = ( get_post_meta( $product['product_id'], '_width', true ) );
|
@@ -387,7 +545,7 @@ class Wafs_Match_Conditions {
|
|
387 |
endforeach;
|
388 |
|
389 |
$max_width = max( (array) $width );
|
390 |
-
|
391 |
if ( '==' == $operator ) :
|
392 |
$match = ( $max_width == $value );
|
393 |
elseif ( '!=' == $operator ) :
|
@@ -399,29 +557,33 @@ class Wafs_Match_Conditions {
|
|
399 |
endif;
|
400 |
|
401 |
return $match;
|
402 |
-
|
403 |
}
|
404 |
|
405 |
-
|
406 |
-
|
|
|
|
|
|
|
407 |
*
|
408 |
-
*
|
409 |
*
|
410 |
-
* @
|
411 |
-
*
|
412 |
-
* @param
|
413 |
-
* @
|
|
|
|
|
414 |
*/
|
415 |
-
|
416 |
public function wafs_match_condition_height( $match, $operator, $value ) {
|
417 |
|
418 |
global $woocommerce;
|
419 |
-
|
420 |
if ( ! isset( $woocommerce->cart ) || empty( $woocommerce->cart->cart_contents ) ) return;
|
421 |
-
|
422 |
foreach ( $woocommerce->cart->cart_contents as $product ) :
|
423 |
|
424 |
-
if ( true == $product['data']->variation_has_height ) :
|
425 |
$height[] = ( get_post_meta( $product['data']->variation_id, '_height', true ) );
|
426 |
else :
|
427 |
$height[] = ( get_post_meta( $product['product_id'], '_height', true ) );
|
@@ -430,7 +592,7 @@ class Wafs_Match_Conditions {
|
|
430 |
endforeach;
|
431 |
|
432 |
$max_height = max( $height );
|
433 |
-
|
434 |
if ( '==' == $operator ) :
|
435 |
$match = ( $max_height == $value );
|
436 |
elseif ( '!=' == $operator ) :
|
@@ -440,31 +602,35 @@ class Wafs_Match_Conditions {
|
|
440 |
elseif ( '<=' == $operator ) :
|
441 |
$match = ( $max_height <= $value );
|
442 |
endif;
|
443 |
-
|
444 |
return $match;
|
445 |
-
|
446 |
}
|
447 |
-
|
448 |
-
|
449 |
-
|
|
|
|
|
|
|
450 |
*
|
451 |
-
*
|
452 |
*
|
453 |
-
* @
|
454 |
-
*
|
455 |
-
* @param
|
456 |
-
* @
|
|
|
|
|
457 |
*/
|
458 |
-
|
459 |
public function wafs_match_condition_length( $match, $operator, $value ) {
|
460 |
|
461 |
global $woocommerce;
|
462 |
-
|
463 |
if ( ! isset( $woocommerce->cart ) || empty( $woocommerce->cart->cart_contents ) ) return;
|
464 |
-
|
465 |
foreach ( $woocommerce->cart->cart_contents as $product ) :
|
466 |
|
467 |
-
if ( true == $product['data']->variation_has_length ) :
|
468 |
$length[] = ( get_post_meta( $product['data']->variation_id, '_length', true ) );
|
469 |
else :
|
470 |
$length[] = ( get_post_meta( $product['product_id'], '_length', true ) );
|
@@ -482,64 +648,43 @@ class Wafs_Match_Conditions {
|
|
482 |
$match = ( $max_length >= $value );
|
483 |
elseif ( '<=' == $operator ) :
|
484 |
$match = ( $max_length <= $value );
|
485 |
-
endif;
|
486 |
-
|
487 |
return $match;
|
488 |
-
|
489 |
}
|
490 |
-
|
491 |
-
|
492 |
-
/* Match weight
|
493 |
-
*
|
494 |
-
* @param bool $match
|
495 |
-
* @param string $operator
|
496 |
-
* @param mixed $value
|
497 |
-
* @return bool
|
498 |
-
*/
|
499 |
-
public function wafs_match_condition_weight( $match, $operator, $value ) {
|
500 |
|
501 |
-
global $woocommerce;
|
502 |
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
}
|
518 |
-
|
519 |
-
|
520 |
-
/* Match all product stock
|
521 |
-
*
|
522 |
-
* @param bool $match
|
523 |
-
* @param string $operator
|
524 |
-
* @param mixed $value
|
525 |
-
* @return bool
|
526 |
*/
|
527 |
public function wafs_match_condition_stock( $match, $operator, $value ) {
|
528 |
|
529 |
global $woocommerce;
|
530 |
-
|
531 |
if ( ! isset( $woocommerce->cart ) || empty( $woocommerce->cart->cart_contents ) ) return;
|
532 |
|
533 |
foreach ( $woocommerce->cart->cart_contents as $product ) :
|
534 |
|
535 |
-
if ( true == $product['data']->variation_has_stock ) :
|
536 |
$stock[] = ( get_post_meta( $product['data']->variation_id, '_stock', true ) );
|
537 |
else :
|
538 |
$stock[] = ( get_post_meta( $product['product_id'], '_stock', true ) );
|
539 |
endif;
|
540 |
|
541 |
endforeach;
|
542 |
-
|
543 |
$min_stock = min( $stock );
|
544 |
|
545 |
if ( '==' == $operator ) :
|
@@ -551,33 +696,40 @@ class Wafs_Match_Conditions {
|
|
551 |
elseif ( '<=' == $operator ) :
|
552 |
$match = ( $min_stock <= $value );
|
553 |
endif;
|
554 |
-
|
555 |
return $match;
|
556 |
-
|
557 |
}
|
558 |
|
559 |
|
560 |
-
|
|
|
|
|
|
|
|
|
|
|
561 |
*
|
562 |
-
* @
|
563 |
-
*
|
564 |
-
* @param
|
565 |
-
* @
|
|
|
|
|
566 |
*/
|
567 |
public function wafs_match_condition_stock_status( $match, $operator, $value ) {
|
568 |
|
569 |
global $woocommerce;
|
570 |
|
571 |
if ( ! isset( $woocommerce->cart ) ) return;
|
572 |
-
|
573 |
if ( '==' == $operator ) :
|
574 |
-
|
575 |
$match = true;
|
576 |
foreach ( $woocommerce->cart->cart_contents as $product ) :
|
577 |
if ( get_post_meta( $product['product_id'], '_stock_status', true ) != $value )
|
578 |
$match = false;
|
579 |
endforeach;
|
580 |
-
|
581 |
elseif ( '!=' == $operator ) :
|
582 |
|
583 |
$match = true;
|
@@ -585,55 +737,63 @@ class Wafs_Match_Conditions {
|
|
585 |
if ( get_post_meta( $product['product_id'], '_stock_status', true ) == $value )
|
586 |
$match = false;
|
587 |
endforeach;
|
588 |
-
|
589 |
endif;
|
590 |
-
|
591 |
return $match;
|
592 |
-
|
593 |
-
}
|
594 |
-
|
595 |
|
596 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
597 |
*
|
598 |
-
* @
|
599 |
-
*
|
600 |
-
* @
|
601 |
-
*
|
|
|
|
|
|
|
|
|
602 |
*/
|
603 |
public function wafs_match_condition_category( $match, $operator, $value ) {
|
604 |
|
605 |
global $woocommerce;
|
606 |
|
607 |
if ( ! isset( $woocommerce->cart ) ) return;
|
608 |
-
|
609 |
$match = true;
|
610 |
-
|
611 |
if ( '==' == $operator ) :
|
612 |
-
|
613 |
foreach ( $woocommerce->cart->cart_contents as $product ) :
|
614 |
|
615 |
if ( ! has_term( $value, 'product_cat', $product['product_id'] ) ) :
|
616 |
$match = false;
|
617 |
endif;
|
618 |
-
|
619 |
endforeach;
|
620 |
-
|
621 |
elseif ( '!=' == $operator ) :
|
622 |
-
|
623 |
foreach ( $woocommerce->cart->cart_contents as $product ) :
|
624 |
-
|
625 |
-
if ( has_term( $value, 'product_cat', $
|
626 |
$match = false;
|
627 |
endif;
|
628 |
-
|
629 |
endforeach;
|
630 |
-
|
631 |
endif;
|
632 |
-
|
633 |
return $match;
|
634 |
-
|
635 |
}
|
636 |
-
|
637 |
}
|
638 |
new Wafs_Match_Conditions();
|
639 |
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
/**
|
4 |
+
* Class WAFS_Match_Conditions.
|
5 |
*
|
6 |
+
* The WAFS Match Conditions class handles the matching rules for Free Shipping.
|
7 |
*
|
8 |
+
* @class WAFS_Match_Conditions
|
9 |
+
* @author Jeroen Sormani
|
10 |
+
* @package WooCommerce Advanced Free Shipping
|
11 |
+
* @version 1.0.0
|
12 |
*/
|
13 |
+
class WAFS_Match_Conditions {
|
14 |
|
15 |
|
16 |
/**
|
17 |
+
* Constructor.
|
18 |
+
*
|
19 |
+
* @since 1.0.0 */
|
20 |
public function __construct() {
|
21 |
+
|
22 |
global $woocommerce;
|
23 |
+
|
24 |
+
add_filter( 'wafs_match_condition_subtotal', array( $this, 'wafs_match_condition_subtotal' ), 10, 3 );
|
25 |
+
add_filter( 'wafs_match_condition_subtotal_ex_tax', array( $this, 'wafs_match_condition_subtotal_ex_tax' ), 10, 3 );
|
26 |
+
add_filter( 'wafs_match_condition_tax', array( $this, 'wafs_match_condition_tax' ), 10, 3 );
|
27 |
+
add_filter( 'wafs_match_condition_quantity', array( $this, 'wafs_match_condition_quantity' ), 10, 3 );
|
28 |
+
add_filter( 'wafs_match_condition_contains_product', array( $this, 'wafs_match_condition_contains_product' ), 10, 3 );
|
29 |
+
add_filter( 'wafs_match_condition_coupon', array( $this, 'wafs_match_condition_coupon' ), 10, 3 );
|
30 |
+
add_filter( 'wafs_match_condition_contains_shipping_class', array( $this, 'wafs_match_condition_contains_shipping_class' ), 10, 3 );
|
31 |
+
|
32 |
+
add_filter( 'wafs_match_condition_zipcode', array( $this, 'wafs_match_condition_zipcode' ), 10, 3 );
|
33 |
+
add_filter( 'wafs_match_condition_city', array( $this, 'wafs_match_condition_city' ), 10, 3 );
|
34 |
+
add_filter( 'wafs_match_condition_state', array( $this, 'wafs_match_condition_state' ), 10, 3 );
|
35 |
+
add_filter( 'wafs_match_condition_country', array( $this, 'wafs_match_condition_country' ), 10, 3 );
|
36 |
+
add_filter( 'wafs_match_condition_role', array( $this, 'wafs_match_condition_role' ), 10, 3 );
|
37 |
+
|
38 |
+
add_filter( 'wafs_match_condition_width', array( $this, 'wafs_match_condition_width' ), 10, 3 );
|
39 |
+
add_filter( 'wafs_match_condition_height', array( $this, 'wafs_match_condition_height' ), 10, 3 );
|
40 |
+
add_filter( 'wafs_match_condition_length', array( $this, 'wafs_match_condition_length' ), 10, 3 );
|
41 |
+
add_filter( 'wafs_match_condition_stock', array( $this, 'wafs_match_condition_stock' ), 10, 3 );
|
42 |
+
add_filter( 'wafs_match_condition_stock_status', array( $this, 'wafs_match_condition_stock_status' ), 10, 3 );
|
43 |
+
add_filter( 'wafs_match_condition_category', array( $this, 'wafs_match_condition_category' ), 10, 3 );
|
44 |
+
|
45 |
}
|
46 |
|
47 |
|
48 |
+
/**
|
49 |
+
* Subtotal.
|
50 |
+
*
|
51 |
+
* Match the condition value against the cart subtotal.
|
52 |
+
*
|
53 |
+
* @since 1.0.0
|
54 |
*
|
55 |
+
* @global object $woocommerce WooCommerce object.
|
56 |
+
*
|
57 |
+
* @param bool $match Current match value.
|
58 |
+
* @param string $operator Operator selected by the user in the condition row.
|
59 |
+
* @param mixed $value Value given by the user in the condition row.
|
60 |
+
* @return BOOL Matching result, TRUE if results match, otherwise FALSE.
|
61 |
*/
|
62 |
public function wafs_match_condition_subtotal( $match, $operator, $value ) {
|
63 |
|
64 |
global $woocommerce;
|
65 |
|
66 |
if ( ! isset( $woocommerce->cart ) ) return;
|
67 |
+
|
68 |
if ( '==' == $operator ) :
|
69 |
$match = ( $woocommerce->cart->subtotal == $value );
|
70 |
elseif ( '!=' == $operator ) :
|
74 |
elseif ( '<=' == $operator ) :
|
75 |
$match = ( $woocommerce->cart->subtotal <= $value );
|
76 |
endif;
|
77 |
+
|
78 |
return $match;
|
79 |
+
|
80 |
}
|
81 |
|
82 |
|
83 |
+
/**
|
84 |
+
* Subtotal excl. taxes.
|
85 |
+
*
|
86 |
+
* Match the condition value against the cart subtotal excl. taxes.
|
87 |
+
*
|
88 |
+
* @since 1.0.0
|
89 |
*
|
90 |
+
* @global object $woocommerce WooCommerce object.
|
91 |
+
*
|
92 |
+
* @param bool $match Current match value.
|
93 |
+
* @param string $operator Operator selected by the user in the condition row.
|
94 |
+
* @param mixed $value Value given by the user in the condition row.
|
95 |
+
* @return BOOL Matching result, TRUE if results match, otherwise FALSE.
|
96 |
*/
|
97 |
public function wafs_match_condition_subtotal_ex_tax( $match, $operator, $value ) {
|
98 |
|
99 |
global $woocommerce;
|
100 |
+
|
101 |
if ( ! isset( $woocommerce->cart ) ) return;
|
102 |
|
103 |
if ( '==' == $operator ) :
|
109 |
elseif ( '<=' == $operator ) :
|
110 |
$match = ( $woocommerce->cart->subtotal_ex_tax <= $value );
|
111 |
endif;
|
112 |
+
|
113 |
return $match;
|
114 |
+
|
115 |
}
|
|
|
116 |
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Taxes.
|
120 |
+
*
|
121 |
+
* Match the condition value against the cart taxes.
|
122 |
+
*
|
123 |
+
* @since 1.0.0
|
124 |
*
|
125 |
+
* @global object $woocommerce WooCommerce object.
|
126 |
+
*
|
127 |
+
* @param bool $match Current match value.
|
128 |
+
* @param string $operator Operator selected by the user in the condition row.
|
129 |
+
* @param mixed $value Value given by the user in the condition row.
|
130 |
+
* @return BOOL Matching result, TRUE if results match, otherwise FALSE.
|
131 |
*/
|
132 |
public function wafs_match_condition_tax( $match, $operator, $value ) {
|
133 |
|
134 |
global $woocommerce;
|
135 |
+
|
136 |
if ( ! isset( $woocommerce->cart ) ) return;
|
137 |
|
138 |
$taxes = array_sum( (array) $woocommerce->cart->taxes );
|
146 |
elseif ( '<=' == $operator ) :
|
147 |
$match = ( $taxes <= $value );
|
148 |
endif;
|
149 |
+
|
150 |
return $match;
|
151 |
+
|
152 |
}
|
|
|
153 |
|
154 |
+
|
155 |
+
/**
|
156 |
+
* Quantity.
|
157 |
+
*
|
158 |
+
* Match the condition value against the cart quantity.
|
159 |
+
* This also includes product quantities.
|
160 |
*
|
161 |
+
* @since 1.0.0
|
162 |
+
*
|
163 |
+
* @global object $woocommerce WooCommerce object.
|
164 |
+
*
|
165 |
+
* @param bool $match Current match value.
|
166 |
+
* @param string $operator Operator selected by the user in the condition row.
|
167 |
+
* @param mixed $value Value given by the user in the condition row.
|
168 |
+
* @return BOOL Matching result, TRUE if results match, otherwise FALSE.
|
169 |
*/
|
170 |
public function wafs_match_condition_quantity( $match, $operator, $value ) {
|
171 |
|
172 |
global $woocommerce;
|
173 |
+
|
174 |
if ( ! isset( $woocommerce->cart ) ) return;
|
175 |
+
|
176 |
if ( '==' == $operator ) :
|
177 |
$match = ( $woocommerce->cart->cart_contents_count == $value );
|
178 |
elseif ( '!=' == $operator ) :
|
182 |
elseif ( '<=' == $operator ) :
|
183 |
$match = ( $woocommerce->cart->cart_contents_count <= $value );
|
184 |
endif;
|
185 |
+
|
186 |
return $match;
|
187 |
+
|
188 |
}
|
|
|
189 |
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Contains product.
|
193 |
*
|
194 |
+
* Matches if the condition value product is in the cart.
|
195 |
+
*
|
196 |
+
* @since 1.0.0
|
197 |
+
*
|
198 |
+
* @global object $woocommerce WooCommerce object.
|
199 |
+
*
|
200 |
+
* @param bool $match Current match value.
|
201 |
+
* @param string $operator Operator selected by the user in the condition row.
|
202 |
+
* @param mixed $value Value given by the user in the condition row.
|
203 |
+
* @return BOOL Matching result, TRUE if results match, otherwise FALSE.
|
204 |
*/
|
205 |
public function wafs_match_condition_contains_product( $match, $operator, $value ) {
|
206 |
|
207 |
global $woocommerce;
|
208 |
+
|
209 |
if ( ! isset( $woocommerce->cart ) || empty( $woocommerce->cart->cart_contents ) ) return;
|
210 |
+
|
211 |
foreach ( $woocommerce->cart->cart_contents as $product ) :
|
212 |
$product_ids[] = $product['product_id'];
|
213 |
endforeach;
|
214 |
+
|
215 |
if ( '==' == $operator ) :
|
216 |
$match = ( in_array( $value, $product_ids ) );
|
217 |
elseif ( '!=' == $operator ) :
|
218 |
$match = ( ! in_array( $value, $product_ids ) );
|
219 |
endif;
|
220 |
+
|
221 |
return $match;
|
222 |
+
|
223 |
}
|
|
|
224 |
|
225 |
+
|
226 |
+
/**
|
227 |
+
* Coupon.
|
228 |
+
*
|
229 |
+
* Match the condition value against the applied coupons.
|
230 |
*
|
231 |
+
* @since 1.0.0
|
232 |
+
*
|
233 |
+
* @global object $woocommerce WooCommerce object.
|
234 |
+
*
|
235 |
+
* @param bool $match Current match value.
|
236 |
+
* @param string $operator Operator selected by the user in the condition row.
|
237 |
+
* @param mixed $value Value given by the user in the condition row.
|
238 |
+
* @return BOOL Matching result, TRUE if results match, otherwise FALSE.
|
239 |
*/
|
240 |
public function wafs_match_condition_coupon( $match, $operator, $value ) {
|
241 |
|
242 |
global $woocommerce;
|
243 |
+
|
244 |
if ( ! isset( $woocommerce->cart ) ) return;
|
245 |
+
|
246 |
if ( '==' == $operator ) :
|
247 |
$match = ( in_array( $value, $woocommerce->cart->applied_coupons ) );
|
248 |
elseif ( '!=' == $operator ) :
|
249 |
$match = ( ! in_array( $value, $woocommerce->cart->applied_coupons ) );
|
250 |
endif;
|
251 |
+
|
252 |
return $match;
|
253 |
+
|
254 |
}
|
255 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
|
257 |
+
/**
|
258 |
+
* Weight.
|
259 |
+
*
|
260 |
+
* Match the condition value against the cart weight.
|
261 |
+
*
|
262 |
+
* @since 1.0.0
|
263 |
+
*
|
264 |
+
* @global object $woocommerce WooCommerce object.
|
265 |
+
*
|
266 |
+
* @param bool $match Current match value.
|
267 |
+
* @param string $operator Operator selected by the user in the condition row.
|
268 |
+
* @param mixed $value Value given by the user in the condition row.
|
269 |
+
* @return BOOL Matching result, TRUE if results match, otherwise FALSE.
|
270 |
+
*/
|
271 |
+
public function wafs_match_condition_weight( $match, $operator, $value ) {
|
272 |
+
|
273 |
+
global $woocommerce;
|
274 |
+
|
275 |
+
if ( ! isset( $woocommerce->cart ) ) return;
|
276 |
+
|
277 |
+
if ( '==' == $operator ) :
|
278 |
+
$match = ( $woocommerce->cart->cart_contents_weight == $value );
|
279 |
+
elseif ( '!=' == $operator ) :
|
280 |
+
$match = ( $woocommerce->cart->cart_contents_weight != $value );
|
281 |
+
elseif ( '>=' == $operator ) :
|
282 |
+
$match = ( $woocommerce->cart->cart_contents_weight >= $value );
|
283 |
+
elseif ( '<=' == $operator ) :
|
284 |
+
$match = ( $woocommerce->cart->cart_contents_weight <= $value );
|
285 |
+
endif;
|
286 |
+
|
287 |
+
return $match;
|
288 |
|
289 |
+
}
|
290 |
+
|
291 |
+
|
292 |
+
/**
|
293 |
+
* Shipping class.
|
294 |
*
|
295 |
+
* Matches if the condition value shipping class is in the cart.
|
296 |
*
|
297 |
+
* @since 1.1.0
|
298 |
+
*
|
299 |
+
* @param bool $match Current match value.
|
300 |
+
* @param string $operator Operator selected by the user in the condition row.
|
301 |
+
* @param mixed $value Value given by the user in the condition row.
|
302 |
+
* @return BOOL Matching result, TRUE if results match, otherwise FALSE. */
|
303 |
+
public function wafs_match_condition_contains_shipping_class( $match, $operator, $value ) {
|
304 |
+
|
305 |
+
global $woocommerce;
|
306 |
+
|
307 |
+
if ( ! isset( $woocommerce->cart ) ) return;
|
308 |
+
|
309 |
+
if ( $operator == '!=' ) :
|
310 |
+
// True until proven false
|
311 |
+
$match = true;
|
312 |
+
endif;
|
313 |
+
|
314 |
+
foreach ( $woocommerce->cart->cart_contents as $product ) :
|
315 |
+
|
316 |
+
$product = get_product( $product['product_id'] );
|
317 |
+
|
318 |
+
if ( $operator == '==' ) :
|
319 |
+
if ( $product->get_shipping_class() == $value ) :
|
320 |
+
return true;
|
321 |
+
endif;
|
322 |
+
elseif ( $operator == '!=' ) :
|
323 |
+
if ( $product->get_shipping_class() == $value ) :
|
324 |
+
return false;
|
325 |
+
endif;
|
326 |
+
endif;
|
327 |
+
|
328 |
+
endforeach;
|
329 |
+
|
330 |
+
return $match;
|
331 |
+
|
332 |
+
}
|
333 |
+
|
334 |
+
|
335 |
+
/******************************************************
|
336 |
+
* User conditions
|
337 |
+
*****************************************************/
|
338 |
+
|
339 |
+
|
340 |
+
/**
|
341 |
+
* Zipcode.
|
342 |
+
*
|
343 |
+
* Match the condition value against the users shipping zipcode.
|
344 |
+
*
|
345 |
+
* @since 1.0.2; $value may contain single or comma (,) separated zipcodes.
|
346 |
+
*
|
347 |
+
* @global object $woocommerce WooCommerce object.
|
348 |
+
*
|
349 |
+
* @param bool $match Current match value.
|
350 |
+
* @param string $operator Operator selected by the user in the condition row.
|
351 |
+
* @param mixed $value Value given by the user in the condition row.
|
352 |
+
* @return BOOL Matching result, TRUE if results match, otherwise FALSE.
|
353 |
*/
|
354 |
public function wafs_match_condition_zipcode( $match, $operator, $value ) {
|
355 |
|
356 |
global $woocommerce;
|
357 |
+
|
358 |
+
if ( ! isset( $woocommerce->customer ) ) return;
|
359 |
|
360 |
if ( '==' == $operator ) :
|
361 |
|
362 |
+
if ( preg_match( '/\, ?/', $value ) ) :
|
363 |
+
$match = ( in_array( (int) $woocommerce->customer->get_shipping_postcode(), array_map( 'intval', explode( ',', $value ) ) ) );
|
364 |
else :
|
365 |
+
$match = ( (int) $woocommerce->customer->get_shipping_postcode() == (int) $value );
|
366 |
endif;
|
367 |
|
368 |
elseif ( '!=' == $operator ) :
|
369 |
|
370 |
+
if ( preg_match( '/\, ?/', $value ) ) :
|
371 |
+
$match = ( ! in_array( (int) $woocommerce->customer->get_shipping_postcode(), array_map( 'intval', explode( ',', $value ) ) ) );
|
372 |
else :
|
373 |
+
$match = ( (int) $woocommerce->customer->get_shipping_postcode() != (int) $value );
|
374 |
endif;
|
375 |
|
376 |
elseif ( '>=' == $operator ) :
|
377 |
+
$match = ( (int) $woocommerce->customer->get_shipping_postcode() >= (int) $value );
|
378 |
elseif ( '<=' == $operator ) :
|
379 |
+
$match = ( (int) $woocommerce->customer->get_shipping_postcode() <= (int) $value );
|
380 |
endif;
|
381 |
+
|
382 |
return $match;
|
383 |
+
|
384 |
}
|
385 |
|
386 |
|
387 |
+
/**
|
388 |
+
* City.
|
389 |
+
*
|
390 |
+
* Match the condition value against the users shipping city.
|
391 |
*
|
392 |
+
* @since 1.0.0
|
393 |
+
*
|
394 |
+
* @global object $woocommerce WooCommerce object.
|
395 |
+
*
|
396 |
+
* @param bool $match Current match value.
|
397 |
+
* @param string $operator Operator selected by the user in the condition row.
|
398 |
+
* @param mixed $value Value given by the user in the condition row.
|
399 |
+
* @return BOOL Matching result, TRUE if results match, otherwise FALSE.
|
400 |
*/
|
401 |
public function wafs_match_condition_city( $match, $operator, $value ) {
|
402 |
|
403 |
global $woocommerce;
|
404 |
+
|
405 |
if ( ! isset( $woocommerce->customer ) ) return;
|
406 |
+
|
407 |
if ( '==' == $operator ) :
|
408 |
$match = ( preg_match( "/^$value$/i", $woocommerce->customer->get_shipping_city() ) );
|
409 |
elseif ( '!=' == $operator ) :
|
410 |
$match = ( ! preg_match( "/^$value$/i", $woocommerce->customer->get_shipping_city() ) );
|
411 |
endif;
|
412 |
+
|
413 |
return $match;
|
414 |
+
|
415 |
}
|
416 |
+
|
417 |
+
|
418 |
+
/**
|
419 |
+
* State.
|
420 |
+
*
|
421 |
+
* Match the condition value against the users shipping state
|
422 |
+
*
|
423 |
+
* @since 1.0.0
|
424 |
+
*
|
425 |
+
* @global object $woocommerce WooCommerce object.
|
426 |
+
*
|
427 |
+
* @param bool $match Current match value.
|
428 |
+
* @param string $operator Operator selected by the user in the condition row.
|
429 |
+
* @param mixed $value Value given by the user in the condition row.
|
430 |
+
* @return BOOL Matching result, TRUE if results match, otherwise FALSE.
|
431 |
+
True if this condition matches, false if condition doesn't match. */
|
432 |
public function wafs_match_condition_state( $match, $operator, $value ) {
|
433 |
|
434 |
global $woocommerce;
|
435 |
+
|
436 |
if ( ! isset( $woocommerce->customer ) ) return;
|
437 |
+
|
438 |
+
$state = $woocommerce->customer->get_shipping_country() . '_' . $woocommerce->customer->get_shipping_state();
|
439 |
+
|
440 |
if ( '==' == $operator ) :
|
441 |
+
$match = ( $state == $value );
|
442 |
elseif ( '!=' == $operator ) :
|
443 |
+
$match = ( $state != $value );
|
444 |
endif;
|
445 |
+
|
446 |
return $match;
|
447 |
+
|
448 |
}
|
449 |
+
|
450 |
+
|
451 |
+
/**
|
452 |
+
* Country.
|
453 |
+
*
|
454 |
+
* Match the condition value against the users shipping country.
|
455 |
+
*
|
456 |
+
* @since 1.0.0
|
457 |
+
*
|
458 |
+
* @global object $woocommerce WooCommerce object.
|
459 |
+
*
|
460 |
+
* @param bool $match Current match value.
|
461 |
+
* @param string $operator Operator selected by the user in the condition row.
|
462 |
+
* @param mixed $value Value given by the user in the condition row.
|
463 |
+
* @return BOOL Matching result, TRUE if results match, otherwise FALSE.
|
464 |
*/
|
465 |
public function wafs_match_condition_country( $match, $operator, $value ) {
|
466 |
|
467 |
global $woocommerce;
|
468 |
+
|
469 |
if ( ! isset( $woocommerce->customer ) ) return;
|
470 |
+
|
471 |
if ( '==' == $operator ) :
|
472 |
$match = ( preg_match( "/^$value$/i", $woocommerce->customer->get_shipping_country() ) );
|
473 |
elseif ( '!=' == $operator ) :
|
474 |
$match = ( ! preg_match( "/^$value$/i", $woocommerce->customer->get_shipping_country() ) );
|
475 |
endif;
|
476 |
+
|
477 |
return $match;
|
478 |
+
|
479 |
}
|
|
|
480 |
|
481 |
+
|
482 |
+
/**
|
483 |
+
* User role.
|
484 |
+
*
|
485 |
+
* Match the condition value against the users role.
|
486 |
+
*
|
487 |
+
* @since 1.0.0
|
488 |
*
|
489 |
+
* @global object $woocommerce WooCommerce object.
|
490 |
+
* @global object $current_user Current user object for capabilities.
|
491 |
+
*
|
492 |
+
* @param bool $match Current match value.
|
493 |
+
* @param string $operator Operator selected by the user in the condition row.
|
494 |
+
* @param mixed $value Value given by the user in the condition row.
|
495 |
+
* @return BOOL Matching result, TRUE if results match, otherwise FALSE.
|
496 |
*/
|
497 |
public function wafs_match_condition_role( $match, $operator, $value ) {
|
498 |
|
503 |
elseif ( '!=' == $operator ) :
|
504 |
$match = ( ! array_key_exists( $value, $current_user->caps ) );
|
505 |
endif;
|
506 |
+
|
507 |
return $match;
|
508 |
+
|
509 |
}
|
|
|
510 |
|
|
|
|
|
|
|
|
|
|
|
|
|
511 |
|
512 |
+
/******************************************************
|
513 |
+
* Product conditions
|
514 |
+
*****************************************************/
|
515 |
|
516 |
+
|
517 |
+
/**
|
518 |
+
* Width.
|
519 |
+
*
|
520 |
+
* Match the condition value against the widest product in the cart.
|
521 |
+
*
|
522 |
+
* @since 1.0.0
|
523 |
*
|
524 |
+
* @global object $woocommerce WooCommerce object.
|
525 |
*
|
526 |
+
* @param bool $match Current match value.
|
527 |
+
* @param string $operator Operator selected by the user in the condition row.
|
528 |
+
* @param mixed $value Value given by the user in the condition row.
|
529 |
+
* @return BOOL Matching result, TRUE if results match, otherwise FALSE.
|
530 |
*/
|
531 |
public function wafs_match_condition_width( $match, $operator, $value ) {
|
532 |
|
533 |
global $woocommerce;
|
534 |
+
|
535 |
if ( ! isset( $woocommerce->cart ) || empty( $woocommerce->cart->cart_contents ) ) return;
|
536 |
+
|
537 |
foreach ( $woocommerce->cart->cart_contents as $product ) :
|
538 |
|
539 |
+
if ( true == $product['data']->variation_has_width ) :
|
540 |
$width[] = ( get_post_meta( $product['data']->variation_id, '_width', true ) );
|
541 |
else :
|
542 |
$width[] = ( get_post_meta( $product['product_id'], '_width', true ) );
|
545 |
endforeach;
|
546 |
|
547 |
$max_width = max( (array) $width );
|
548 |
+
|
549 |
if ( '==' == $operator ) :
|
550 |
$match = ( $max_width == $value );
|
551 |
elseif ( '!=' == $operator ) :
|
557 |
endif;
|
558 |
|
559 |
return $match;
|
560 |
+
|
561 |
}
|
562 |
|
563 |
+
|
564 |
+
/**
|
565 |
+
* Height.
|
566 |
+
*
|
567 |
+
* Match the condition value against the highest product in the cart.
|
568 |
*
|
569 |
+
* @since 1.0.0
|
570 |
*
|
571 |
+
* @global object $woocommerce WooCommerce object.
|
572 |
+
*
|
573 |
+
* @param bool $match Current match value.
|
574 |
+
* @param string $operator Operator selected by the user in the condition row.
|
575 |
+
* @param mixed $value Value given by the user in the condition row.
|
576 |
+
* @return BOOL Matching result, TRUE if results match, otherwise FALSE.
|
577 |
*/
|
|
|
578 |
public function wafs_match_condition_height( $match, $operator, $value ) {
|
579 |
|
580 |
global $woocommerce;
|
581 |
+
|
582 |
if ( ! isset( $woocommerce->cart ) || empty( $woocommerce->cart->cart_contents ) ) return;
|
583 |
+
|
584 |
foreach ( $woocommerce->cart->cart_contents as $product ) :
|
585 |
|
586 |
+
if ( true == $product['data']->variation_has_height ) :
|
587 |
$height[] = ( get_post_meta( $product['data']->variation_id, '_height', true ) );
|
588 |
else :
|
589 |
$height[] = ( get_post_meta( $product['product_id'], '_height', true ) );
|
592 |
endforeach;
|
593 |
|
594 |
$max_height = max( $height );
|
595 |
+
|
596 |
if ( '==' == $operator ) :
|
597 |
$match = ( $max_height == $value );
|
598 |
elseif ( '!=' == $operator ) :
|
602 |
elseif ( '<=' == $operator ) :
|
603 |
$match = ( $max_height <= $value );
|
604 |
endif;
|
605 |
+
|
606 |
return $match;
|
607 |
+
|
608 |
}
|
609 |
+
|
610 |
+
|
611 |
+
/**
|
612 |
+
* Length.
|
613 |
+
*
|
614 |
+
* Match the condition value against the lenghtiest product in the cart.
|
615 |
*
|
616 |
+
* @since 1.0.0
|
617 |
*
|
618 |
+
* @global object $woocommerce WooCommerce object.
|
619 |
+
*
|
620 |
+
* @param bool $match Current match value.
|
621 |
+
* @param string $operator Operator selected by the user in the condition row.
|
622 |
+
* @param mixed $value Value given by the user in the condition row.
|
623 |
+
* @return BOOL Matching result, TRUE if results match, otherwise FALSE.
|
624 |
*/
|
|
|
625 |
public function wafs_match_condition_length( $match, $operator, $value ) {
|
626 |
|
627 |
global $woocommerce;
|
628 |
+
|
629 |
if ( ! isset( $woocommerce->cart ) || empty( $woocommerce->cart->cart_contents ) ) return;
|
630 |
+
|
631 |
foreach ( $woocommerce->cart->cart_contents as $product ) :
|
632 |
|
633 |
+
if ( true == $product['data']->variation_has_length ) :
|
634 |
$length[] = ( get_post_meta( $product['data']->variation_id, '_length', true ) );
|
635 |
else :
|
636 |
$length[] = ( get_post_meta( $product['product_id'], '_length', true ) );
|
648 |
$match = ( $max_length >= $value );
|
649 |
elseif ( '<=' == $operator ) :
|
650 |
$match = ( $max_length <= $value );
|
651 |
+
endif;
|
652 |
+
|
653 |
return $match;
|
654 |
+
|
655 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
656 |
|
|
|
657 |
|
658 |
+
/**
|
659 |
+
* Product stock.
|
660 |
+
*
|
661 |
+
* Match the condition value against all cart products stock.
|
662 |
+
*
|
663 |
+
* @since 1.0.0
|
664 |
+
*
|
665 |
+
* @global object $woocommerce WooCommerce object.
|
666 |
+
*
|
667 |
+
* @param bool $match Current match value.
|
668 |
+
* @param string $operator Operator selected by the user in the condition row.
|
669 |
+
* @param mixed $value Value given by the user in the condition row.
|
670 |
+
* @return BOOL Matching result, TRUE if results match, otherwise FALSE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
671 |
*/
|
672 |
public function wafs_match_condition_stock( $match, $operator, $value ) {
|
673 |
|
674 |
global $woocommerce;
|
675 |
+
|
676 |
if ( ! isset( $woocommerce->cart ) || empty( $woocommerce->cart->cart_contents ) ) return;
|
677 |
|
678 |
foreach ( $woocommerce->cart->cart_contents as $product ) :
|
679 |
|
680 |
+
if ( true == $product['data']->variation_has_stock ) :
|
681 |
$stock[] = ( get_post_meta( $product['data']->variation_id, '_stock', true ) );
|
682 |
else :
|
683 |
$stock[] = ( get_post_meta( $product['product_id'], '_stock', true ) );
|
684 |
endif;
|
685 |
|
686 |
endforeach;
|
687 |
+
|
688 |
$min_stock = min( $stock );
|
689 |
|
690 |
if ( '==' == $operator ) :
|
696 |
elseif ( '<=' == $operator ) :
|
697 |
$match = ( $min_stock <= $value );
|
698 |
endif;
|
699 |
+
|
700 |
return $match;
|
701 |
+
|
702 |
}
|
703 |
|
704 |
|
705 |
+
/**
|
706 |
+
* Stock status.
|
707 |
+
*
|
708 |
+
* Match the condition value against all cart products stock statusses.
|
709 |
+
*
|
710 |
+
* @since 1.0.0
|
711 |
*
|
712 |
+
* @global object $woocommerce WooCommerce object.
|
713 |
+
*
|
714 |
+
* @param bool $match Current match value.
|
715 |
+
* @param string $operator Operator selected by the user in the condition row.
|
716 |
+
* @param mixed $value Value given by the user in the condition row.
|
717 |
+
* @return BOOL Matching result, TRUE if results match, otherwise FALSE.
|
718 |
*/
|
719 |
public function wafs_match_condition_stock_status( $match, $operator, $value ) {
|
720 |
|
721 |
global $woocommerce;
|
722 |
|
723 |
if ( ! isset( $woocommerce->cart ) ) return;
|
724 |
+
|
725 |
if ( '==' == $operator ) :
|
726 |
+
|
727 |
$match = true;
|
728 |
foreach ( $woocommerce->cart->cart_contents as $product ) :
|
729 |
if ( get_post_meta( $product['product_id'], '_stock_status', true ) != $value )
|
730 |
$match = false;
|
731 |
endforeach;
|
732 |
+
|
733 |
elseif ( '!=' == $operator ) :
|
734 |
|
735 |
$match = true;
|
737 |
if ( get_post_meta( $product['product_id'], '_stock_status', true ) == $value )
|
738 |
$match = false;
|
739 |
endforeach;
|
740 |
+
|
741 |
endif;
|
742 |
+
|
743 |
return $match;
|
|
|
|
|
|
|
744 |
|
745 |
+
}
|
746 |
+
|
747 |
+
|
748 |
+
/**
|
749 |
+
* Category.
|
750 |
+
*
|
751 |
+
* Match the condition value against all the cart products category.
|
752 |
+
* With this condition, all the products in the cart must have the given class.
|
753 |
*
|
754 |
+
* @since 1.0.0
|
755 |
+
*
|
756 |
+
* @global object $woocommerce WooCommerce object.
|
757 |
+
*
|
758 |
+
* @param bool $match Current match value.
|
759 |
+
* @param string $operator Operator selected by the user in the condition row.
|
760 |
+
* @param mixed $value Value given by the user in the condition row.
|
761 |
+
* @return BOOL Matching result, TRUE if results match, otherwise FALSE.
|
762 |
*/
|
763 |
public function wafs_match_condition_category( $match, $operator, $value ) {
|
764 |
|
765 |
global $woocommerce;
|
766 |
|
767 |
if ( ! isset( $woocommerce->cart ) ) return;
|
768 |
+
|
769 |
$match = true;
|
770 |
+
|
771 |
if ( '==' == $operator ) :
|
772 |
+
|
773 |
foreach ( $woocommerce->cart->cart_contents as $product ) :
|
774 |
|
775 |
if ( ! has_term( $value, 'product_cat', $product['product_id'] ) ) :
|
776 |
$match = false;
|
777 |
endif;
|
778 |
+
|
779 |
endforeach;
|
780 |
+
|
781 |
elseif ( '!=' == $operator ) :
|
782 |
+
|
783 |
foreach ( $woocommerce->cart->cart_contents as $product ) :
|
784 |
+
|
785 |
+
if ( has_term( $value, 'product_cat', $product['product_id'] ) ) :
|
786 |
$match = false;
|
787 |
endif;
|
788 |
+
|
789 |
endforeach;
|
790 |
+
|
791 |
endif;
|
792 |
+
|
793 |
return $match;
|
794 |
+
|
795 |
}
|
796 |
+
|
797 |
}
|
798 |
new Wafs_Match_Conditions();
|
799 |
|
includes/class-wafs-method.php
CHANGED
@@ -1,254 +1,260 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
if (
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
endif;
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
return $matched_methods;
|
86 |
-
|
87 |
-
}
|
88 |
-
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Match conditions
|
92 |
-
*
|
93 |
-
* @access public
|
94 |
-
* @return void
|
95 |
-
*/
|
96 |
-
public function wafs_match_conditions( $condition_groups = array() ) {
|
97 |
-
|
98 |
-
if ( empty( $condition_groups ) ) return false;
|
99 |
-
|
100 |
-
foreach ( $condition_groups as $condition_group => $conditions ) :
|
101 |
-
|
102 |
-
$match_condition_group = true;
|
103 |
-
|
104 |
-
foreach ( $conditions as $condition ) :
|
105 |
-
|
106 |
-
$match = apply_filters( 'wafs_match_condition_' . $condition['condition'], false, $condition['operator'], $condition['value'] );
|
107 |
-
|
108 |
-
if ( false == $match ) :
|
109 |
-
$match_condition_group = false;
|
110 |
-
endif;
|
111 |
-
|
112 |
-
endforeach;
|
113 |
-
|
114 |
-
// return true if one condition group matches
|
115 |
-
if ( true == $match_condition_group ) :
|
116 |
-
return true;
|
117 |
endif;
|
118 |
-
|
119 |
endforeach;
|
120 |
-
|
121 |
-
return
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
* @return void
|
131 |
-
*/
|
132 |
-
public function init_form_fields() {
|
133 |
-
|
134 |
-
$this->form_fields = array(
|
135 |
-
'enabled' => array(
|
136 |
-
'title' => __( 'Enable/Disable', 'woocommerce' ),
|
137 |
-
'type' => 'checkbox',
|
138 |
-
'label' => __( 'Enable Advanced Free Shipping', 'wafs' ),
|
139 |
-
'default' => 'yes'
|
140 |
-
),
|
141 |
-
'hide_other_shipping_when_available' => array(
|
142 |
-
'title' => __( 'Hide other shipping', 'wafs' ),
|
143 |
-
'type' => 'checkbox',
|
144 |
-
'label' => __( 'Hide other shipping methods when free shipping is available', 'wafs' ),
|
145 |
-
'default' => 'no'
|
146 |
-
),
|
147 |
-
'conditions' => array(
|
148 |
-
'type' => 'conditions_table',
|
149 |
-
)
|
150 |
-
);
|
151 |
-
|
152 |
-
|
153 |
-
}
|
154 |
-
|
155 |
-
/* Settings tab table.
|
156 |
-
*
|
157 |
-
* Load and render the table on the Advanced Free Shipping settings tab.
|
158 |
-
*
|
159 |
-
* @return string
|
160 |
-
*/
|
161 |
-
public function generate_conditions_table_html() {
|
162 |
-
|
163 |
-
ob_start();
|
164 |
-
|
165 |
-
/**
|
166 |
-
* Load conditions table file
|
167 |
-
*/
|
168 |
-
require_once plugin_dir_path( __FILE__ ) . 'admin/views/conditions-table.php';
|
169 |
-
|
170 |
-
return ob_get_clean();
|
171 |
-
|
172 |
-
}
|
173 |
-
|
174 |
-
|
175 |
-
/**
|
176 |
-
* validate_additional_conditions_table_field function.
|
177 |
-
*
|
178 |
-
* @access public
|
179 |
-
* @param mixed $key
|
180 |
-
* @return bool
|
181 |
-
*/
|
182 |
-
public function validate_additional_conditions_table_field( $key ) {
|
183 |
-
return false;
|
184 |
-
}
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
/**
|
189 |
-
* calculate_shipping function.
|
190 |
-
*
|
191 |
-
* @access public
|
192 |
-
* @param mixed $package
|
193 |
-
* @return void
|
194 |
-
*/
|
195 |
-
public function calculate_shipping( $package ) {
|
196 |
-
|
197 |
-
if ( false == $this->matched_methods || 'no' == $this->enabled ) return;
|
198 |
-
|
199 |
-
$match_details = get_post_meta( $this->matched_methods, '_wafs_shipping_method', true );
|
200 |
-
$label = $match_details['shipping_title'];
|
201 |
-
$calc_tax = @$match_details['calc_tax'];
|
202 |
-
|
203 |
-
$rate = array(
|
204 |
-
'id' => $this->id,
|
205 |
-
'label' => ( null == $label ) ? __( 'Free Shipping', 'wafs' ) : $label,
|
206 |
-
'cost' => '0',
|
207 |
-
'calc_tax' => ( null == $calc_tax ) ? 'per_order' : $calc_tax
|
208 |
-
);
|
209 |
-
|
210 |
-
// Register the rate
|
211 |
-
$this->add_rate( $rate );
|
212 |
-
|
213 |
-
|
214 |
-
}
|
215 |
-
|
216 |
-
|
217 |
-
/**
|
218 |
-
* Hide shipping.
|
219 |
-
*
|
220 |
-
* Hide Shipping methods when regular or advanced free shipping is available
|
221 |
-
*
|
222 |
-
* @param array $available_methods
|
223 |
-
* @return array
|
224 |
-
*/
|
225 |
-
public function hide_all_shipping_when_free_is_available( $available_methods ) {
|
226 |
-
|
227 |
-
if ( 'no' == $this->hide_shipping ) return $available_methods;
|
228 |
-
|
229 |
-
if ( isset( $available_methods['advanced_free_shipping'] ) ) :
|
230 |
-
|
231 |
-
return array( $available_methods['advanced_free_shipping'] );
|
232 |
-
|
233 |
-
elseif ( isset( $available_methods['free_shipping'] ) ) :
|
234 |
-
|
235 |
-
return array( $available_methods['free_shipping'] );
|
236 |
-
|
237 |
-
else :
|
238 |
-
|
239 |
-
return $available_methods;
|
240 |
-
|
241 |
-
endif;
|
242 |
-
|
243 |
-
|
244 |
-
}
|
245 |
-
|
246 |
-
|
247 |
}
|
248 |
-
$wafs_free_shipping_method = new Wafs_Free_Shipping_Method();
|
249 |
-
|
250 |
-
}
|
251 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
|
|
|
253 |
|
254 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
|
4 |
+
if ( class_exists( 'Wafs_Free_Shipping_Method' ) ) return; // Stop if the class already exists
|
5 |
+
|
6 |
+
|
7 |
+
class Wafs_Free_Shipping_Method extends WC_Shipping_Method {
|
8 |
+
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Constructor.
|
12 |
+
*
|
13 |
+
* @since 1.0.0
|
14 |
+
*/
|
15 |
+
public function __construct() {
|
16 |
+
|
17 |
+
$this->id = 'advanced_free_shipping';
|
18 |
+
$this->title = __( 'Free Shipping <small>(may change at user configuration)</small>', 'woocommerce-advanced-free-shipping' );
|
19 |
+
$this->method_title = __( 'Advanced Free Shipping', 'woocommerce-advanced-free-shipping' );
|
20 |
+
$this->method_description = __( 'Configure WooCommerce Advanced Free Shipping' ); //
|
21 |
+
|
22 |
+
$this->matched_methods = $this->wafs_match_methods();
|
23 |
+
|
24 |
+
$this->init();
|
25 |
+
|
26 |
+
}
|
27 |
+
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Init.
|
31 |
+
*
|
32 |
+
* Initialize WAFS shipping method.
|
33 |
+
*
|
34 |
+
* @since 1.0.0
|
35 |
+
*/
|
36 |
+
function init() {
|
37 |
+
|
38 |
+
$this->init_form_fields();
|
39 |
+
$this->init_settings();
|
40 |
+
|
41 |
+
$this->enabled = $this->get_option( 'enabled' );
|
42 |
+
$this->hide_shipping = $this->get_option( 'hide_other_shipping' );
|
43 |
+
|
44 |
+
// Save settings in admin if you have any defined
|
45 |
+
add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
|
46 |
+
|
47 |
+
// Hide shipping methods
|
48 |
+
global $woocommerce;
|
49 |
+
if ( version_compare( $woocommerce->version, '2.1', '<' ) ) :
|
50 |
+
add_filter( 'woocommerce_available_shipping_methods', array( $this, 'hide_all_shipping_when_free_is_available' ) );
|
51 |
+
else :
|
52 |
+
add_filter( 'woocommerce_package_rates', array( $this, 'hide_all_shipping_when_free_is_available' ) );
|
53 |
+
endif;
|
54 |
+
|
55 |
+
}
|
56 |
+
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Match methods.
|
60 |
+
*
|
61 |
+
* Checks if methods matches conditions.
|
62 |
+
*
|
63 |
+
* @since 1.0.0
|
64 |
+
*
|
65 |
+
* @return array Only the first matched method (since you won't need two free shippings).
|
66 |
+
*/
|
67 |
+
public function wafs_match_methods() {
|
68 |
+
|
69 |
+
$methods = get_posts( array( 'posts_per_page' => '-1', 'post_type' => 'wafs' ) );
|
70 |
+
|
71 |
+
$matched_methods = '';
|
72 |
+
foreach ( $methods as $method ) :
|
73 |
+
|
74 |
+
$condition_groups = get_post_meta( $method->ID, '_wafs_shipping_method_conditions', true );
|
75 |
+
|
76 |
+
// Check if method conditions match
|
77 |
+
$match = $this->wafs_match_conditions( $condition_groups );
|
78 |
+
|
79 |
+
// Add (single) match to parameter
|
80 |
+
if ( true == $match ) :
|
81 |
+
$matched_methods = $method->ID;
|
82 |
endif;
|
83 |
|
84 |
+
endforeach;
|
85 |
+
|
86 |
+
return $matched_methods;
|
87 |
+
|
88 |
+
}
|
89 |
+
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Match conditions.
|
93 |
+
*
|
94 |
+
* Method to check all condition groups and conditions if they match their rules.
|
95 |
+
*
|
96 |
+
* @since 1.0.0
|
97 |
+
*
|
98 |
+
* @param array $condition_groups All condition groups set by the user.
|
99 |
+
* @return BOOL True if one of the conditions groups matches.
|
100 |
+
*/
|
101 |
+
public function wafs_match_conditions( $condition_groups = array() ) {
|
102 |
+
|
103 |
+
if ( empty( $condition_groups ) ) return false;
|
104 |
+
|
105 |
+
foreach ( $condition_groups as $condition_group => $conditions ) :
|
106 |
+
|
107 |
+
$match_condition_group = true;
|
108 |
+
|
109 |
+
foreach ( $conditions as $condition ) :
|
110 |
+
|
111 |
+
$match = apply_filters( 'wafs_match_condition_' . $condition['condition'], false, $condition['operator'], $condition['value'] );
|
112 |
+
|
113 |
+
if ( false == $match ) :
|
114 |
+
$match_condition_group = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
endif;
|
116 |
+
|
117 |
endforeach;
|
118 |
+
|
119 |
+
// return true if one condition group matches
|
120 |
+
if ( true == $match_condition_group ) :
|
121 |
+
return true;
|
122 |
+
endif;
|
123 |
+
|
124 |
+
endforeach;
|
125 |
+
|
126 |
+
return false;
|
127 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
}
|
|
|
|
|
|
|
129 |
|
130 |
+
/**
|
131 |
+
* Init fields.
|
132 |
+
*
|
133 |
+
* Add fields to the WAFS shipping settings page.
|
134 |
+
*
|
135 |
+
* @since 1.0.0
|
136 |
+
*/
|
137 |
+
public function init_form_fields() {
|
138 |
+
|
139 |
+
$this->form_fields = array(
|
140 |
+
'enabled' => array(
|
141 |
+
'title' => __( 'Enable/Disable', 'woocommerce' ),
|
142 |
+
'type' => 'checkbox',
|
143 |
+
'label' => __( 'Enable Advanced Free Shipping', 'woocommerce-advanced-free-shipping' ),
|
144 |
+
'default' => 'yes'
|
145 |
+
),
|
146 |
+
'hide_other_shipping' => array(
|
147 |
+
'title' => __( 'Hide other shipping', 'woocommerce-advanced-free-shipping' ),
|
148 |
+
'type' => 'checkbox',
|
149 |
+
'label' => __( 'Hide other shipping methods when free shipping is available', 'woocommerce-advanced-free-shipping' ),
|
150 |
+
'default' => 'no'
|
151 |
+
),
|
152 |
+
'conditions' => array(
|
153 |
+
'type' => 'conditions_table',
|
154 |
+
)
|
155 |
+
);
|
156 |
+
|
157 |
+
}
|
158 |
+
|
159 |
+
|
160 |
+
/**
|
161 |
+
* Settings tab table.
|
162 |
+
*
|
163 |
+
* Load and render the table on the Advanced Free Shipping settings tab.
|
164 |
+
*
|
165 |
+
* @since 1.0.0
|
166 |
+
*
|
167 |
+
* @return string Conditions table HTML.
|
168 |
+
*/
|
169 |
+
public function generate_conditions_table_html() {
|
170 |
+
|
171 |
+
ob_start();
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Load conditions table file
|
175 |
+
*/
|
176 |
+
require_once plugin_dir_path( __FILE__ ) . 'admin/views/conditions-table.php';
|
177 |
+
|
178 |
+
return ob_get_clean();
|
179 |
+
|
180 |
+
}
|
181 |
+
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Validate table.
|
185 |
+
*
|
186 |
+
* Condition table does not need validation, so always return false.
|
187 |
+
*
|
188 |
+
* @since 1.0.0
|
189 |
+
*
|
190 |
+
* @param mixed $key Key.
|
191 |
+
* @return bool Validation.
|
192 |
+
*/
|
193 |
+
public function validate_additional_conditions_table_field( $key ) {
|
194 |
+
return false;
|
195 |
+
}
|
196 |
+
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Calculate shipping.
|
200 |
+
*
|
201 |
+
* Calculate shipping costs (which is always free).
|
202 |
+
*
|
203 |
+
* @since 1.0.0
|
204 |
+
*
|
205 |
+
* @param mixed $package
|
206 |
+
*/
|
207 |
+
public function calculate_shipping( $package ) {
|
208 |
|
209 |
+
if ( false == $this->matched_methods || 'no' == $this->enabled ) return;
|
210 |
|
211 |
+
$match_details = get_post_meta( $this->matched_methods, '_wafs_shipping_method', true );
|
212 |
+
$label = $match_details['shipping_title'];
|
213 |
+
$calc_tax = @$match_details['calc_tax'];
|
214 |
+
|
215 |
+
$rate = array(
|
216 |
+
'id' => $this->id,
|
217 |
+
'label' => ( null == $label ) ? __( 'Free Shipping', 'woocommerce-advanced-free-shipping' ) : $label,
|
218 |
+
'cost' => '0',
|
219 |
+
'calc_tax' => ( null == $calc_tax ) ? 'per_order' : $calc_tax
|
220 |
+
);
|
221 |
+
|
222 |
+
// Register the rate
|
223 |
+
$this->add_rate( $rate );
|
224 |
+
|
225 |
+
}
|
226 |
+
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Hide shipping.
|
230 |
+
*
|
231 |
+
* Hide Shipping methods when regular or advanced free shipping is available.
|
232 |
+
*
|
233 |
+
* @since 1.0.0
|
234 |
+
*
|
235 |
+
* @param array $available_methods List of available methods.
|
236 |
+
* @return array List of modified available methods.
|
237 |
+
*/
|
238 |
+
public function hide_all_shipping_when_free_is_available( $available_methods ) {
|
239 |
+
|
240 |
+
if ( 'no' == $this->hide_shipping ) return $available_methods;
|
241 |
+
|
242 |
+
if ( isset( $available_methods['advanced_free_shipping'] ) ) :
|
243 |
+
|
244 |
+
return array( $available_methods['advanced_free_shipping'] );
|
245 |
+
|
246 |
+
elseif ( isset( $available_methods['free_shipping'] ) ) :
|
247 |
+
|
248 |
+
return array( $available_methods['free_shipping'] );
|
249 |
+
|
250 |
+
else :
|
251 |
+
|
252 |
+
return $available_methods;
|
253 |
+
|
254 |
+
endif;
|
255 |
+
|
256 |
+
}
|
257 |
+
|
258 |
+
|
259 |
+
}
|
260 |
+
$wafs_free_shipping_method = new Wafs_Free_Shipping_Method();
|
includes/class-wafs-post-type.php
CHANGED
@@ -1,51 +1,61 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
-
* Class
|
4 |
*
|
5 |
* Initialize the WAFS post type
|
6 |
*
|
7 |
-
* @class
|
8 |
* @author Jeroen Sormani
|
9 |
* @package WooCommerce Advanced Free Shipping
|
10 |
* @version 1.0.0
|
11 |
*/
|
12 |
-
class
|
13 |
-
|
14 |
-
|
15 |
/**
|
16 |
-
*
|
17 |
*
|
18 |
-
*
|
19 |
*/
|
20 |
public function __construct() {
|
21 |
-
|
22 |
$this->wafs_register_post_type();
|
23 |
|
|
|
24 |
add_action( 'add_meta_boxes', array( $this, 'wafs_post_type_meta_box' ) );
|
25 |
add_action( 'save_post', array( $this, 'wafs_save_meta' ) );
|
26 |
add_action( 'save_post', array( $this, 'wafs_save_condition_meta' ) );
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
29 |
-
|
30 |
-
|
31 |
/**
|
32 |
-
*
|
|
|
|
|
33 |
*
|
34 |
-
*
|
35 |
*/
|
36 |
public function wafs_register_post_type() {
|
37 |
-
|
38 |
$labels = array(
|
39 |
-
'name' => __( 'Advanced Free Shipping methods', '
|
40 |
-
'singular_name' => __( 'Advanced Free Shipping method', '
|
41 |
-
'add_new' => __( 'Add New', '
|
42 |
-
'add_new_item' => __( 'Add New Advanced Free Shipping method' , '
|
43 |
-
'edit_item' => __( 'Edit Advanced Free Shipping method' , '
|
44 |
-
'new_item' => __( 'New Advanced Free Shipping method' , '
|
45 |
-
'view_item' => __( 'View Advanced Free Shipping method', '
|
46 |
-
'search_items' => __( 'Search Advanced Free Shipping methods', '
|
47 |
-
'not_found' => __( 'No Advanced Free Shipping methods', '
|
48 |
-
'not_found_in_trash' => __( 'No Advanced Free Shipping methods found in Trash', '
|
49 |
);
|
50 |
|
51 |
register_post_type( 'wafs', array(
|
@@ -60,110 +70,199 @@ class Wafs_post_type {
|
|
60 |
'supports' => array( 'title' ),
|
61 |
'labels' => $labels,
|
62 |
) );
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
}
|
65 |
-
|
66 |
-
|
67 |
/**
|
68 |
-
*
|
69 |
*
|
70 |
-
*
|
|
|
|
|
71 |
*/
|
72 |
public function wafs_post_type_meta_box() {
|
73 |
-
|
74 |
-
add_meta_box( 'wafs_conditions', __( 'Advanced Free Shipping conditions', '
|
75 |
-
add_meta_box( 'wafs_settings', __( 'Shipping settings', '
|
76 |
-
|
77 |
}
|
78 |
-
|
79 |
-
|
80 |
/**
|
81 |
-
*
|
|
|
|
|
82 |
*
|
83 |
-
*
|
84 |
*/
|
85 |
public function render_wafs_conditions() {
|
86 |
-
|
87 |
/**
|
88 |
-
* Load meta box conditions view
|
89 |
*/
|
90 |
require_once plugin_dir_path( __FILE__ ) . 'admin/settings/meta-box-conditions.php';
|
91 |
-
|
92 |
}
|
93 |
-
|
94 |
-
|
95 |
/**
|
96 |
-
*
|
|
|
|
|
97 |
*
|
98 |
-
*
|
99 |
*/
|
100 |
public function render_wafs_settings() {
|
101 |
-
|
102 |
/**
|
103 |
* Load meta box settings view
|
104 |
*/
|
105 |
require_once plugin_dir_path( __FILE__ ) . 'admin/settings/meta-box-settings.php';
|
106 |
-
|
107 |
}
|
108 |
-
|
109 |
-
|
110 |
/**
|
111 |
-
*
|
112 |
*
|
113 |
-
* Validate and save post meta
|
|
|
|
|
114 |
*/
|
115 |
-
public function
|
116 |
-
|
117 |
-
if ( !isset( $_POST['
|
118 |
return $post_id;
|
119 |
-
|
120 |
-
$nonce = $_POST['
|
121 |
-
|
122 |
-
if ( ! wp_verify_nonce( $nonce, '
|
123 |
return $post_id;
|
124 |
-
|
125 |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
126 |
return $post_id;
|
127 |
-
|
128 |
if ( ! current_user_can( 'manage_woocommerce' ) )
|
129 |
return $post_id;
|
130 |
-
|
131 |
-
$shipping_method = $_POST['_wafs_shipping_method'];
|
132 |
|
133 |
-
|
134 |
-
|
|
|
|
|
135 |
}
|
136 |
-
|
137 |
-
|
138 |
/**
|
139 |
-
*
|
|
|
|
|
140 |
*
|
141 |
-
*
|
142 |
*/
|
143 |
-
public function
|
144 |
-
|
145 |
-
if ( !isset( $_POST['
|
146 |
return $post_id;
|
147 |
-
|
148 |
-
$nonce = $_POST['
|
149 |
-
|
150 |
-
if ( ! wp_verify_nonce( $nonce, '
|
151 |
return $post_id;
|
152 |
-
|
153 |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
154 |
return $post_id;
|
155 |
-
|
156 |
if ( ! current_user_can( 'manage_woocommerce' ) )
|
157 |
return $post_id;
|
158 |
-
|
159 |
-
$shipping_method_conditions = $_POST['_wafs_shipping_method_conditions'];
|
160 |
|
161 |
-
|
|
|
|
|
162 |
|
163 |
}
|
164 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
}
|
166 |
-
$wafs_post_type = new
|
167 |
|
168 |
/**
|
169 |
* Load condition object
|
@@ -173,5 +272,3 @@ require_once plugin_dir_path( __FILE__ ) . 'admin/settings/conditions/class-wafs
|
|
173 |
* Load ajax methods
|
174 |
*/
|
175 |
require_once plugin_dir_path( __FILE__ ) . '/class-wafs-ajax.php';
|
176 |
-
|
177 |
-
?>
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
/**
|
4 |
+
* Class WAFS_post_type
|
5 |
*
|
6 |
* Initialize the WAFS post type
|
7 |
*
|
8 |
+
* @class WAFS_post_type
|
9 |
* @author Jeroen Sormani
|
10 |
* @package WooCommerce Advanced Free Shipping
|
11 |
* @version 1.0.0
|
12 |
*/
|
13 |
+
class WAFS_post_type {
|
14 |
+
|
15 |
+
|
16 |
/**
|
17 |
+
* Constructor.
|
18 |
*
|
19 |
+
* @since 1.0.0
|
20 |
*/
|
21 |
public function __construct() {
|
22 |
+
|
23 |
$this->wafs_register_post_type();
|
24 |
|
25 |
+
// Add/save meta boxes
|
26 |
add_action( 'add_meta_boxes', array( $this, 'wafs_post_type_meta_box' ) );
|
27 |
add_action( 'save_post', array( $this, 'wafs_save_meta' ) );
|
28 |
add_action( 'save_post', array( $this, 'wafs_save_condition_meta' ) );
|
29 |
+
|
30 |
+
// Edit user messages
|
31 |
+
add_filter( 'post_updated_messages', array( $this, 'wafs_custom_post_type_messages' ) );
|
32 |
+
|
33 |
+
// Redirect after delete
|
34 |
+
add_action('load-edit.php', array( $this, 'wafs_redirect_after_trash' ) );
|
35 |
+
|
36 |
}
|
37 |
+
|
38 |
+
|
39 |
/**
|
40 |
+
* Post type.
|
41 |
+
*
|
42 |
+
* Register 'wafs' post type.
|
43 |
*
|
44 |
+
* @since 1.0.0
|
45 |
*/
|
46 |
public function wafs_register_post_type() {
|
47 |
+
|
48 |
$labels = array(
|
49 |
+
'name' => __( 'Advanced Free Shipping methods', 'woocommerce-advanced-free-shipping' ),
|
50 |
+
'singular_name' => __( 'Advanced Free Shipping method', 'woocommerce-advanced-free-shipping' ),
|
51 |
+
'add_new' => __( 'Add New', 'woocommerce-advanced-free-shipping' ),
|
52 |
+
'add_new_item' => __( 'Add New Advanced Free Shipping method' , 'woocommerce-advanced-free-shipping' ),
|
53 |
+
'edit_item' => __( 'Edit Advanced Free Shipping method' , 'woocommerce-advanced-free-shipping' ),
|
54 |
+
'new_item' => __( 'New Advanced Free Shipping method' , 'woocommerce-advanced-free-shipping' ),
|
55 |
+
'view_item' => __( 'View Advanced Free Shipping method', 'woocommerce-advanced-free-shipping' ),
|
56 |
+
'search_items' => __( 'Search Advanced Free Shipping methods', 'woocommerce-advanced-free-shipping' ),
|
57 |
+
'not_found' => __( 'No Advanced Free Shipping methods', 'woocommerce-advanced-free-shipping' ),
|
58 |
+
'not_found_in_trash' => __( 'No Advanced Free Shipping methods found in Trash', 'woocommerce-advanced-free-shipping' ),
|
59 |
);
|
60 |
|
61 |
register_post_type( 'wafs', array(
|
70 |
'supports' => array( 'title' ),
|
71 |
'labels' => $labels,
|
72 |
) );
|
73 |
+
|
74 |
+
}
|
75 |
+
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Messages.
|
79 |
+
*
|
80 |
+
* Modify the notice messages text for the 'was' post type.
|
81 |
+
*
|
82 |
+
* @since 1.0.0
|
83 |
+
*
|
84 |
+
* @param array $messages Existing list of messages.
|
85 |
+
* @return array Modified list of messages.
|
86 |
+
*/
|
87 |
+
function wafs_custom_post_type_messages( $messages ) {
|
88 |
+
|
89 |
+
$post = get_post();
|
90 |
+
$post_type = get_post_type( $post );
|
91 |
+
$post_type_object = get_post_type_object( $post_type );
|
92 |
+
|
93 |
+
$messages['wafs'] = array(
|
94 |
+
0 => '',
|
95 |
+
1 => __( 'Free shipping method updated.', 'woocommerce-advanced-free-shipping' ),
|
96 |
+
2 => __( 'Custom field updated.', 'woocommerce-advanced-free-shipping' ),
|
97 |
+
3 => __( 'Custom field deleted.', 'woocommerce-advanced-free-shipping' ),
|
98 |
+
4 => __( 'Free shipping method updated.', 'woocommerce-advanced-free-shipping' ),
|
99 |
+
5 => isset( $_GET['revision'] ) ?
|
100 |
+
sprintf( __( 'Free shipping method restored to revision from %s', 'woocommerce-advanced-free-shipping' ), wp_post_revision_title( (int) $_GET['revision'], false ) )
|
101 |
+
: false,
|
102 |
+
6 => __( 'Free shipping method published.', 'woocommerce-advanced-free-shipping' ),
|
103 |
+
7 => __( 'Free shipping method saved.', 'woocommerce-advanced-free-shipping' ),
|
104 |
+
8 => __( 'Free shipping method submitted.', 'woocommerce-advanced-free-shipping' ),
|
105 |
+
9 => sprintf(
|
106 |
+
__( 'Free shipping method scheduled for: <strong>%1$s</strong>.', 'woocommerce-advanced-free-shipping' ),
|
107 |
+
date_i18n( __( 'M j, Y @ G:i', 'woocommerce-advanced-free-shipping' ), strtotime( $post->post_date ) )
|
108 |
+
),
|
109 |
+
10 => __( 'Free shipping method draft updated.', 'woocommerce-advanced-free-shipping' ),
|
110 |
+
);
|
111 |
+
|
112 |
+
if ( 'wafs' == $post_type ) :
|
113 |
+
$overview_link = admin_url( 'admin.php?page=wc-settings&tab=shipping§ion=wafs_free_shipping_method' );
|
114 |
+
|
115 |
+
$overview = sprintf( ' <a href="%s">%s</a>', esc_url( $overview_link ), __( 'Return to overview.', 'woocommerce-advanced-free-shipping' ) );
|
116 |
+
$messages[ $post_type ][1] .= $overview;
|
117 |
+
$messages[ $post_type ][6] .= $overview;
|
118 |
+
$messages[ $post_type ][9] .= $overview;
|
119 |
+
$messages[ $post_type ][8] .= $overview;
|
120 |
+
$messages[ $post_type ][10] .= $overview;
|
121 |
+
|
122 |
+
endif;
|
123 |
+
|
124 |
+
return $messages;
|
125 |
+
|
126 |
}
|
127 |
+
|
128 |
+
|
129 |
/**
|
130 |
+
* Add meta boxes.
|
131 |
*
|
132 |
+
* Add two meta boxes to WAFS with conditions and settings.
|
133 |
+
*
|
134 |
+
* @since 1.0.0
|
135 |
*/
|
136 |
public function wafs_post_type_meta_box() {
|
137 |
+
|
138 |
+
add_meta_box( 'wafs_conditions', __( 'Advanced Free Shipping conditions', 'woocommerce-advanced-free-shipping' ), array( $this, 'render_wafs_conditions' ), 'wafs', 'normal' );
|
139 |
+
add_meta_box( 'wafs_settings', __( 'Shipping settings', 'woocommerce-advanced-free-shipping' ), array( $this, 'render_wafs_settings' ), 'wafs', 'normal' );
|
140 |
+
|
141 |
}
|
142 |
+
|
143 |
+
|
144 |
/**
|
145 |
+
* Render meta box.
|
146 |
+
*
|
147 |
+
* Render and display the condition meta box contents.
|
148 |
*
|
149 |
+
* @since 1.0.0
|
150 |
*/
|
151 |
public function render_wafs_conditions() {
|
152 |
+
|
153 |
/**
|
154 |
+
* Load meta box conditions view.
|
155 |
*/
|
156 |
require_once plugin_dir_path( __FILE__ ) . 'admin/settings/meta-box-conditions.php';
|
157 |
+
|
158 |
}
|
159 |
+
|
160 |
+
|
161 |
/**
|
162 |
+
* Render meta box.
|
163 |
+
*
|
164 |
+
* Render and display the settings meta box conditions.
|
165 |
*
|
166 |
+
* @since 1.0.0
|
167 |
*/
|
168 |
public function render_wafs_settings() {
|
169 |
+
|
170 |
/**
|
171 |
* Load meta box settings view
|
172 |
*/
|
173 |
require_once plugin_dir_path( __FILE__ ) . 'admin/settings/meta-box-settings.php';
|
174 |
+
|
175 |
}
|
176 |
+
|
177 |
+
|
178 |
/**
|
179 |
+
* Save conditions meta box.
|
180 |
*
|
181 |
+
* Validate and save post meta from conditions meta box.
|
182 |
+
*
|
183 |
+
* @since 1.0.0
|
184 |
*/
|
185 |
+
public function wafs_save_condition_meta( $post_id ) {
|
186 |
+
|
187 |
+
if ( ! isset( $_POST['wafs_conditions_meta_box_nonce'] ) )
|
188 |
return $post_id;
|
189 |
+
|
190 |
+
$nonce = $_POST['wafs_conditions_meta_box_nonce'];
|
191 |
+
|
192 |
+
if ( ! wp_verify_nonce( $nonce, 'wafs_conditions_meta_box' ) )
|
193 |
return $post_id;
|
194 |
+
|
195 |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
196 |
return $post_id;
|
197 |
+
|
198 |
if ( ! current_user_can( 'manage_woocommerce' ) )
|
199 |
return $post_id;
|
|
|
|
|
200 |
|
201 |
+
$shipping_method_conditions = $_POST['_wafs_shipping_method_conditions'];
|
202 |
+
|
203 |
+
update_post_meta( $post_id, '_wafs_shipping_method_conditions', $shipping_method_conditions );
|
204 |
+
|
205 |
}
|
206 |
+
|
207 |
+
|
208 |
/**
|
209 |
+
* Save settings meta box.
|
210 |
+
*
|
211 |
+
* Validate and save post meta from settings meta box.
|
212 |
*
|
213 |
+
* @since 1.0.0
|
214 |
*/
|
215 |
+
public function wafs_save_meta( $post_id ) {
|
216 |
+
|
217 |
+
if ( !isset( $_POST['wafs_settings_meta_box_nonce'] ) )
|
218 |
return $post_id;
|
219 |
+
|
220 |
+
$nonce = $_POST['wafs_settings_meta_box_nonce'];
|
221 |
+
|
222 |
+
if ( ! wp_verify_nonce( $nonce, 'wafs_settings_meta_box' ) )
|
223 |
return $post_id;
|
224 |
+
|
225 |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
226 |
return $post_id;
|
227 |
+
|
228 |
if ( ! current_user_can( 'manage_woocommerce' ) )
|
229 |
return $post_id;
|
|
|
|
|
230 |
|
231 |
+
$shipping_method = $_POST['_wafs_shipping_method'];
|
232 |
+
|
233 |
+
update_post_meta( $post_id, '_wafs_shipping_method', $shipping_method );
|
234 |
|
235 |
}
|
236 |
+
|
237 |
+
|
238 |
+
/**
|
239 |
+
* Redirect trash.
|
240 |
+
*
|
241 |
+
* Redirect user after trashing a WAFS post.
|
242 |
+
*
|
243 |
+
* @since 1.0.0
|
244 |
+
*/
|
245 |
+
public function wafs_redirect_after_trash() {
|
246 |
+
|
247 |
+
$screen = get_current_screen();
|
248 |
+
|
249 |
+
if( 'edit-wafs' == $screen->id ) :
|
250 |
+
|
251 |
+
if( isset( $_GET['trashed'] ) && intval( $_GET['trashed'] ) > 0 ) :
|
252 |
+
|
253 |
+
$redirect = admin_url( '/admin.php?page=wc-settings&tab=shipping§ion=wafs_free_shipping_method' );
|
254 |
+
wp_redirect( $redirect );
|
255 |
+
exit();
|
256 |
+
|
257 |
+
endif;
|
258 |
+
|
259 |
+
endif;
|
260 |
+
|
261 |
+
|
262 |
+
}
|
263 |
+
|
264 |
}
|
265 |
+
$wafs_post_type = new WAFS_post_type();
|
266 |
|
267 |
/**
|
268 |
* Load condition object
|
272 |
* Load ajax methods
|
273 |
*/
|
274 |
require_once plugin_dir_path( __FILE__ ) . '/class-wafs-ajax.php';
|
|
|
|
languages/wafs-pl_PL.mo
DELETED
Binary file
|
languages/wafs-pl_PL.po
DELETED
@@ -1,535 +0,0 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: WooCommerce Advanced Free Shipping\n"
|
4 |
-
"POT-Creation-Date: 2014-06-12 07:55+0100\n"
|
5 |
-
"PO-Revision-Date: 2014-06-16 00:52+0100\n"
|
6 |
-
"Last-Translator: Kamil Macejko <kamil@gabinet.co.uk>\n"
|
7 |
-
"Language-Team: \n"
|
8 |
-
"Language: pl_PL\n"
|
9 |
-
"MIME-Version: 1.0\n"
|
10 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
-
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"X-Generator: Poedit 1.5.7\n"
|
13 |
-
"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
|
14 |
-
"X-Poedit-Basepath: ../\n"
|
15 |
-
"X-Poedit-SearchPath-0: ..\n"
|
16 |
-
|
17 |
-
#: ../branches/child-conditions/includes/class-wafs-ajax.php:61
|
18 |
-
#: ../branches/child-conditions/includes/admin/settings/meta-box-conditions.php:31
|
19 |
-
#: ../tags/1.0.1/includes/class-wafs-ajax.php:48
|
20 |
-
#: ../tags/1.0.1/includes/admin/settings/meta-box-conditions.php:29
|
21 |
-
#: ../trunk/includes/class-wafs-ajax.php:51
|
22 |
-
#: ../trunk/includes/admin/settings/meta-box-conditions.php:31
|
23 |
-
msgid "Or match all of the following rules to allow free shipping:"
|
24 |
-
msgstr "Lub dopasuj wszystkie poniższe reguły aby zezwolić na darmową wysyłkę"
|
25 |
-
|
26 |
-
#: ../branches/child-conditions/includes/class-wafs-ajax.php:68
|
27 |
-
#: ../branches/child-conditions/includes/admin/settings/meta-box-conditions.php:53
|
28 |
-
#: ../tags/1.0.1/includes/class-wafs-ajax.php:55
|
29 |
-
#: ../tags/1.0.1/includes/admin/settings/meta-box-conditions.php:39
|
30 |
-
#: ../trunk/includes/class-wafs-ajax.php:58
|
31 |
-
#: ../trunk/includes/admin/settings/meta-box-conditions.php:41
|
32 |
-
msgid "Or"
|
33 |
-
msgstr "albo"
|
34 |
-
|
35 |
-
#: ../branches/child-conditions/includes/class-wafs-free-shipping-method.php:20
|
36 |
-
#: ../tags/1.0.1/includes/class-wafs-method.php:18
|
37 |
-
#: ../trunk/includes/class-wafs-free-shipping-method.php:20
|
38 |
-
msgid "Free Shipping <small>(may change at user configuration)</small>"
|
39 |
-
msgstr ""
|
40 |
-
"Darmowa dostawa <small>(może być różne w zależności od ustawień użytkownika)"
|
41 |
-
"</small>"
|
42 |
-
|
43 |
-
#: ../branches/child-conditions/includes/class-wafs-free-shipping-method.php:21
|
44 |
-
#: ../tags/1.0.1/includes/class-wafs-method.php:19
|
45 |
-
#: ../trunk/includes/class-wafs-free-shipping-method.php:21
|
46 |
-
msgid "Advanced Free Shipping"
|
47 |
-
msgstr "Advanced Free Shipping"
|
48 |
-
|
49 |
-
#: ../branches/child-conditions/includes/class-wafs-free-shipping-method.php:22
|
50 |
-
#: ../tags/1.0.1/includes/class-wafs-method.php:20
|
51 |
-
#: ../trunk/includes/class-wafs-free-shipping-method.php:22
|
52 |
-
msgid "Configure WooCommerce Advanced Free Shipping"
|
53 |
-
msgstr "Ustawienia WooCommerce Advanced Free Shipping"
|
54 |
-
|
55 |
-
#: ../branches/child-conditions/includes/class-wafs-free-shipping-method.php:159
|
56 |
-
#: ../tags/1.0.1/includes/class-wafs-method.php:129
|
57 |
-
#: ../trunk/includes/class-wafs-free-shipping-method.php:137
|
58 |
-
msgid "Enable/Disable"
|
59 |
-
msgstr "Włącz/Wyłącz"
|
60 |
-
|
61 |
-
#: ../branches/child-conditions/includes/class-wafs-free-shipping-method.php:161
|
62 |
-
#: ../tags/1.0.1/includes/class-wafs-method.php:131
|
63 |
-
#: ../trunk/includes/class-wafs-free-shipping-method.php:139
|
64 |
-
msgid "Enable Advanced Free Shipping"
|
65 |
-
msgstr "Włącz Advanced Free Shipping"
|
66 |
-
|
67 |
-
#: ../branches/child-conditions/includes/class-wafs-free-shipping-method.php:165
|
68 |
-
#: ../tags/1.0.1/includes/class-wafs-method.php:135
|
69 |
-
#: ../trunk/includes/class-wafs-free-shipping-method.php:143
|
70 |
-
msgid "Hide other shipping"
|
71 |
-
msgstr "Ukryj inne metody wysyłki"
|
72 |
-
|
73 |
-
#: ../branches/child-conditions/includes/class-wafs-free-shipping-method.php:167
|
74 |
-
#: ../tags/1.0.1/includes/class-wafs-method.php:137
|
75 |
-
#: ../trunk/includes/class-wafs-free-shipping-method.php:145
|
76 |
-
msgid "Hide other shipping methods when free shipping is available"
|
77 |
-
msgstr "Ukryj inne metody wysyłki gdy dostępna jest darmowa wysyłka"
|
78 |
-
|
79 |
-
#: ../branches/child-conditions/includes/class-wafs-free-shipping-method.php:228
|
80 |
-
#: ../branches/child-conditions/includes/admin/views/conditions-table.php:58
|
81 |
-
#: ../tags/1.0.1/includes/class-wafs-method.php:198
|
82 |
-
#: ../tags/1.0.1/includes/admin/views/conditions-table.php:56
|
83 |
-
#: ../trunk/includes/class-wafs-free-shipping-method.php:206
|
84 |
-
#: ../trunk/includes/admin/views/conditions-table.php:58
|
85 |
-
msgid "Free Shipping"
|
86 |
-
msgstr "Darmowa wysyłak"
|
87 |
-
|
88 |
-
#: ../branches/child-conditions/includes/class-wafs-post-type.php:42
|
89 |
-
#: ../tags/1.0.1/includes/class-wafs-post-type.php:39
|
90 |
-
#: ../trunk/includes/class-wafs-post-type.php:42
|
91 |
-
msgid "Advanced Free Shipping methods"
|
92 |
-
msgstr "Metody Advanced Free Shipping"
|
93 |
-
|
94 |
-
#: ../branches/child-conditions/includes/class-wafs-post-type.php:43
|
95 |
-
#: ../tags/1.0.1/includes/class-wafs-post-type.php:40
|
96 |
-
#: ../trunk/includes/class-wafs-post-type.php:43
|
97 |
-
msgid "Advanced Free Shipping method"
|
98 |
-
msgstr "Metoda Advanced Free Shipping"
|
99 |
-
|
100 |
-
#: ../branches/child-conditions/includes/class-wafs-post-type.php:44
|
101 |
-
#: ../tags/1.0.1/includes/class-wafs-post-type.php:41
|
102 |
-
#: ../trunk/includes/class-wafs-post-type.php:44
|
103 |
-
msgid "Add New"
|
104 |
-
msgstr "Dodaj"
|
105 |
-
|
106 |
-
#: ../branches/child-conditions/includes/class-wafs-post-type.php:45
|
107 |
-
#: ../tags/1.0.1/includes/class-wafs-post-type.php:42
|
108 |
-
#: ../trunk/includes/class-wafs-post-type.php:45
|
109 |
-
msgid "Add New Advanced Free Shipping method"
|
110 |
-
msgstr "Dodaj nową metodę Advanced Free Shipping"
|
111 |
-
|
112 |
-
#: ../branches/child-conditions/includes/class-wafs-post-type.php:46
|
113 |
-
#: ../tags/1.0.1/includes/class-wafs-post-type.php:43
|
114 |
-
#: ../trunk/includes/class-wafs-post-type.php:46
|
115 |
-
msgid "Edit Advanced Free Shipping method"
|
116 |
-
msgstr "Edytuj metodę Advanced Free Shipping"
|
117 |
-
|
118 |
-
#: ../branches/child-conditions/includes/class-wafs-post-type.php:47
|
119 |
-
#: ../tags/1.0.1/includes/class-wafs-post-type.php:44
|
120 |
-
#: ../trunk/includes/class-wafs-post-type.php:47
|
121 |
-
msgid "New Advanced Free Shipping method"
|
122 |
-
msgstr "Nowa metoda Advanced Free Shipping"
|
123 |
-
|
124 |
-
# I've translated 'view' in the sense 'see', if it should be in the sense 'check' it should be 'Podejrzyj"
|
125 |
-
#: ../branches/child-conditions/includes/class-wafs-post-type.php:48
|
126 |
-
#: ../tags/1.0.1/includes/class-wafs-post-type.php:45
|
127 |
-
#: ../trunk/includes/class-wafs-post-type.php:48
|
128 |
-
msgid "View Advanced Free Shipping method"
|
129 |
-
msgstr "Zobacz metodę Advance Free Shipping"
|
130 |
-
|
131 |
-
#: ../branches/child-conditions/includes/class-wafs-post-type.php:49
|
132 |
-
#: ../tags/1.0.1/includes/class-wafs-post-type.php:46
|
133 |
-
#: ../trunk/includes/class-wafs-post-type.php:49
|
134 |
-
msgid "Search Advanced Free Shipping methods"
|
135 |
-
msgstr "Szukaj metod Advanced Free Shippig"
|
136 |
-
|
137 |
-
#: ../branches/child-conditions/includes/class-wafs-post-type.php:50
|
138 |
-
#: ../tags/1.0.1/includes/class-wafs-post-type.php:47
|
139 |
-
#: ../trunk/includes/class-wafs-post-type.php:50
|
140 |
-
msgid "No Advanced Free Shipping methods"
|
141 |
-
msgstr "Brak metod Advanced Free Shipping"
|
142 |
-
|
143 |
-
#: ../branches/child-conditions/includes/class-wafs-post-type.php:51
|
144 |
-
#: ../tags/1.0.1/includes/class-wafs-post-type.php:48
|
145 |
-
#: ../trunk/includes/class-wafs-post-type.php:51
|
146 |
-
msgid "No Advanced Free Shipping methods found in Trash"
|
147 |
-
msgstr "W koszu nie ma żadnych metod Advanced Free Shipping"
|
148 |
-
|
149 |
-
#: ../branches/child-conditions/includes/class-wafs-post-type.php:77
|
150 |
-
#: ../tags/1.0.1/includes/class-wafs-post-type.php:74
|
151 |
-
#: ../trunk/includes/class-wafs-post-type.php:77
|
152 |
-
msgid "Advanced Free Shipping conditions"
|
153 |
-
msgstr "Warunki Advanced Free Shipping"
|
154 |
-
|
155 |
-
#: ../branches/child-conditions/includes/class-wafs-post-type.php:78
|
156 |
-
#: ../tags/1.0.1/includes/class-wafs-post-type.php:75
|
157 |
-
#: ../trunk/includes/class-wafs-post-type.php:78
|
158 |
-
msgid "Shipping settings"
|
159 |
-
msgstr "Ustawienia wysyłki"
|
160 |
-
|
161 |
-
#: ../branches/child-conditions/includes/admin/settings/meta-box-conditions.php:22
|
162 |
-
#: ../tags/1.0.1/includes/admin/settings/meta-box-conditions.php:20
|
163 |
-
#: ../trunk/includes/admin/settings/meta-box-conditions.php:22
|
164 |
-
msgid "Match all of the following rules to allow free shipping:"
|
165 |
-
msgstr "Wszystkie poniższe muszą się zgadzać aby zezwolić na darmową wysyłkę"
|
166 |
-
|
167 |
-
#: ../branches/child-conditions/includes/admin/settings/meta-box-conditions.php:68
|
168 |
-
#: ../tags/1.0.1/includes/admin/settings/meta-box-conditions.php:54
|
169 |
-
#: ../trunk/includes/admin/settings/meta-box-conditions.php:56
|
170 |
-
msgid "Add 'Or' group"
|
171 |
-
msgstr "Dodaj grupę \"albo\""
|
172 |
-
|
173 |
-
#: ../branches/child-conditions/includes/admin/settings/meta-box-settings.php:23
|
174 |
-
#: ../branches/child-conditions/includes/admin/views/conditions-table.php:27
|
175 |
-
#: ../tags/1.0.1/includes/admin/settings/meta-box-settings.php:21
|
176 |
-
#: ../tags/1.0.1/includes/admin/views/conditions-table.php:24
|
177 |
-
#: ../trunk/includes/admin/settings/meta-box-settings.php:23
|
178 |
-
#: ../trunk/includes/admin/views/conditions-table.php:27
|
179 |
-
msgid "Shipping title"
|
180 |
-
msgstr "Nazwa wysyłki"
|
181 |
-
|
182 |
-
#: ../branches/child-conditions/includes/admin/settings/meta-box-settings.php:25
|
183 |
-
#: ../tags/1.0.1/includes/admin/settings/meta-box-settings.php:23
|
184 |
-
#: ../trunk/includes/admin/settings/meta-box-settings.php:25
|
185 |
-
msgid "e.g. Free Shipping"
|
186 |
-
msgstr "np. Darmowa wysyłka"
|
187 |
-
|
188 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-conditions.php:8
|
189 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-conditions.php:6
|
190 |
-
#: ../trunk/includes/admin/settings/conditions/condition-conditions.php:8
|
191 |
-
msgid "Cart"
|
192 |
-
msgstr "Karta"
|
193 |
-
|
194 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-conditions.php:9
|
195 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-conditions.php:7
|
196 |
-
#: ../trunk/includes/admin/settings/conditions/condition-conditions.php:9
|
197 |
-
msgid "Subtotal"
|
198 |
-
msgstr "Suma"
|
199 |
-
|
200 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-conditions.php:10
|
201 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-conditions.php:8
|
202 |
-
#: ../trunk/includes/admin/settings/conditions/condition-conditions.php:10
|
203 |
-
msgid "Subtotal ex. taxes"
|
204 |
-
msgstr "Suma bez podatku"
|
205 |
-
|
206 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-conditions.php:11
|
207 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-conditions.php:9
|
208 |
-
#: ../trunk/includes/admin/settings/conditions/condition-conditions.php:11
|
209 |
-
msgid "Tax"
|
210 |
-
msgstr "Podatek"
|
211 |
-
|
212 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-conditions.php:12
|
213 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/child-conditions/condition-child-conditions.php:9
|
214 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-conditions.php:10
|
215 |
-
#: ../trunk/includes/admin/settings/conditions/condition-conditions.php:12
|
216 |
-
msgid "Quantity"
|
217 |
-
msgstr "Ilość"
|
218 |
-
|
219 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-conditions.php:13
|
220 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-conditions.php:11
|
221 |
-
#: ../trunk/includes/admin/settings/conditions/condition-conditions.php:13
|
222 |
-
msgid "Contains product"
|
223 |
-
msgstr "Zawiera produkt"
|
224 |
-
|
225 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-conditions.php:14
|
226 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-conditions.php:12
|
227 |
-
#: ../trunk/includes/admin/settings/conditions/condition-conditions.php:14
|
228 |
-
msgid "Coupon"
|
229 |
-
msgstr "Kupon"
|
230 |
-
|
231 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-conditions.php:16
|
232 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-conditions.php:14
|
233 |
-
#: ../trunk/includes/admin/settings/conditions/condition-conditions.php:16
|
234 |
-
msgid "User Details"
|
235 |
-
msgstr "Dane użytkownika"
|
236 |
-
|
237 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-conditions.php:17
|
238 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-conditions.php:15
|
239 |
-
#: ../trunk/includes/admin/settings/conditions/condition-conditions.php:17
|
240 |
-
msgid "Zipcode"
|
241 |
-
msgstr "Kod pocztowy"
|
242 |
-
|
243 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-conditions.php:18
|
244 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-conditions.php:16
|
245 |
-
#: ../trunk/includes/admin/settings/conditions/condition-conditions.php:18
|
246 |
-
msgid "City"
|
247 |
-
msgstr "Miasto"
|
248 |
-
|
249 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-conditions.php:19
|
250 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-conditions.php:17
|
251 |
-
#: ../trunk/includes/admin/settings/conditions/condition-conditions.php:19
|
252 |
-
msgid "State"
|
253 |
-
msgstr "Stan"
|
254 |
-
|
255 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-conditions.php:20
|
256 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-conditions.php:18
|
257 |
-
#: ../trunk/includes/admin/settings/conditions/condition-conditions.php:20
|
258 |
-
msgid "Country"
|
259 |
-
msgstr "Kraj"
|
260 |
-
|
261 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-conditions.php:21
|
262 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-conditions.php:19
|
263 |
-
#: ../trunk/includes/admin/settings/conditions/condition-conditions.php:21
|
264 |
-
msgid "User role"
|
265 |
-
msgstr "Rola użytkownika"
|
266 |
-
|
267 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-conditions.php:23
|
268 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/child-conditions/condition-child-conditions.php:8
|
269 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-conditions.php:21
|
270 |
-
#: ../trunk/includes/admin/settings/conditions/condition-conditions.php:23
|
271 |
-
msgid "Product"
|
272 |
-
msgstr "Produkt"
|
273 |
-
|
274 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-conditions.php:24
|
275 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-conditions.php:22
|
276 |
-
#: ../trunk/includes/admin/settings/conditions/condition-conditions.php:24
|
277 |
-
msgid "Width"
|
278 |
-
msgstr "Szerokość"
|
279 |
-
|
280 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-conditions.php:25
|
281 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-conditions.php:23
|
282 |
-
#: ../trunk/includes/admin/settings/conditions/condition-conditions.php:25
|
283 |
-
msgid "Height"
|
284 |
-
msgstr "Wysokość"
|
285 |
-
|
286 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-conditions.php:26
|
287 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-conditions.php:24
|
288 |
-
#: ../trunk/includes/admin/settings/conditions/condition-conditions.php:26
|
289 |
-
msgid "Length"
|
290 |
-
msgstr "Długość"
|
291 |
-
|
292 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-conditions.php:27
|
293 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/child-conditions/condition-child-conditions.php:11
|
294 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-conditions.php:25
|
295 |
-
#: ../trunk/includes/admin/settings/conditions/condition-conditions.php:27
|
296 |
-
msgid "Weight"
|
297 |
-
msgstr "Waga"
|
298 |
-
|
299 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-conditions.php:28
|
300 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/child-conditions/condition-child-conditions.php:12
|
301 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-conditions.php:26
|
302 |
-
#: ../trunk/includes/admin/settings/conditions/condition-conditions.php:28
|
303 |
-
msgid "Stock"
|
304 |
-
msgstr "Magazyn"
|
305 |
-
|
306 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-conditions.php:29
|
307 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/child-conditions/condition-child-conditions.php:13
|
308 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-conditions.php:27
|
309 |
-
#: ../trunk/includes/admin/settings/conditions/condition-conditions.php:29
|
310 |
-
msgid "Stock status"
|
311 |
-
msgstr "Stan magazynu"
|
312 |
-
|
313 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-conditions.php:30
|
314 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-conditions.php:28
|
315 |
-
#: ../trunk/includes/admin/settings/conditions/condition-conditions.php:30
|
316 |
-
msgid "Backorders"
|
317 |
-
msgstr "Zamówienia oczekujące"
|
318 |
-
|
319 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-conditions.php:31
|
320 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-conditions.php:29
|
321 |
-
#: ../trunk/includes/admin/settings/conditions/condition-conditions.php:31
|
322 |
-
msgid "Category"
|
323 |
-
msgstr "Kategoria"
|
324 |
-
|
325 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-descriptions.php:10
|
326 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/child-conditions/condition-child-descriptions.php:10
|
327 |
-
#: ../trunk/includes/admin/settings/conditions/condition-descriptions.php:10
|
328 |
-
msgid "'(Not) Equal to' values can be separated by comma"
|
329 |
-
msgstr "Wartości 'To (nie) jest' mogą być oddzielone przecinkiem"
|
330 |
-
|
331 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-descriptions.php:11
|
332 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/child-conditions/condition-child-descriptions.php:11
|
333 |
-
#: ../trunk/includes/admin/settings/conditions/condition-descriptions.php:11
|
334 |
-
msgid "By default states are only available in the U.S."
|
335 |
-
msgstr "Domyślnie \"stany\" są dostępne tylko w USA"
|
336 |
-
|
337 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-descriptions.php:12
|
338 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/child-conditions/condition-child-descriptions.php:12
|
339 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-descriptions.php:9
|
340 |
-
#: ../trunk/includes/admin/settings/conditions/condition-descriptions.php:12
|
341 |
-
msgid "Weight calculated on all the cart contents"
|
342 |
-
msgstr "Waga obliczona na podstawie wszystkich produktów z karty"
|
343 |
-
|
344 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-descriptions.php:13
|
345 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/child-conditions/condition-child-descriptions.php:13
|
346 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-descriptions.php:10
|
347 |
-
#: ../trunk/includes/admin/settings/conditions/condition-descriptions.php:13
|
348 |
-
msgid "Compared to lengthiest product in cart"
|
349 |
-
msgstr "Na podstawie najdłuższego produktu w karcie"
|
350 |
-
|
351 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-descriptions.php:14
|
352 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/child-conditions/condition-child-descriptions.php:14
|
353 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-descriptions.php:11
|
354 |
-
#: ../trunk/includes/admin/settings/conditions/condition-descriptions.php:14
|
355 |
-
msgid "Compared to widest product in cart"
|
356 |
-
msgstr "Na podstawie najszerszego produktu w karcie"
|
357 |
-
|
358 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-descriptions.php:15
|
359 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/child-conditions/condition-child-descriptions.php:15
|
360 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-descriptions.php:12
|
361 |
-
#: ../trunk/includes/admin/settings/conditions/condition-descriptions.php:15
|
362 |
-
msgid "Compared to highest product in cart"
|
363 |
-
msgstr "Na podstawie najwyższego produktu w karcie"
|
364 |
-
|
365 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-descriptions.php:16
|
366 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/child-conditions/condition-child-descriptions.php:16
|
367 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-descriptions.php:13
|
368 |
-
#: ../trunk/includes/admin/settings/conditions/condition-descriptions.php:16
|
369 |
-
msgid "All products in cart must match stock status"
|
370 |
-
msgstr "Wszystkie produkty w karcie muszą zgadzać się ze stanem magazynowym"
|
371 |
-
|
372 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-descriptions.php:17
|
373 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/child-conditions/condition-child-descriptions.php:17
|
374 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-descriptions.php:14
|
375 |
-
#: ../trunk/includes/admin/settings/conditions/condition-descriptions.php:17
|
376 |
-
msgid "All products in cart must match backorder"
|
377 |
-
msgstr ""
|
378 |
-
"Wszystkie produkty w karcie muszą odpowiadać statusowi zamówień oczekujących"
|
379 |
-
|
380 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-descriptions.php:18
|
381 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/child-conditions/condition-child-descriptions.php:18
|
382 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-descriptions.php:15
|
383 |
-
#: ../trunk/includes/admin/settings/conditions/condition-descriptions.php:18
|
384 |
-
msgid "All products in cart must match category"
|
385 |
-
msgstr "Wszystkie produkty w karcie muszą odpowiadać kategorii"
|
386 |
-
|
387 |
-
# 'One' or 'at least one'?
|
388 |
-
# if 'at least one' change 'jeden' to 'przynajmniej jeden'
|
389 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-descriptions.php:19
|
390 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/child-conditions/condition-child-descriptions.php:19
|
391 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-descriptions.php:16
|
392 |
-
#: ../trunk/includes/admin/settings/conditions/condition-descriptions.php:19
|
393 |
-
msgid "Cart must contain one of this product"
|
394 |
-
msgstr "Karta musi zawierać jeden z tych produktów"
|
395 |
-
|
396 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-operators.php:8
|
397 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/child-conditions/condition-child-operators.php:8
|
398 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-operators.php:6
|
399 |
-
#: ../trunk/includes/admin/settings/conditions/condition-operators.php:8
|
400 |
-
msgid "Equal to"
|
401 |
-
msgstr "To jest"
|
402 |
-
|
403 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-operators.php:9
|
404 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/child-conditions/condition-child-operators.php:9
|
405 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-operators.php:7
|
406 |
-
#: ../trunk/includes/admin/settings/conditions/condition-operators.php:9
|
407 |
-
msgid "Not equal to"
|
408 |
-
msgstr "To nie jest"
|
409 |
-
|
410 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-operators.php:10
|
411 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/child-conditions/condition-child-operators.php:10
|
412 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-operators.php:8
|
413 |
-
#: ../trunk/includes/admin/settings/conditions/condition-operators.php:10
|
414 |
-
msgid "Greater or equal to"
|
415 |
-
msgstr "Nie mniej niż"
|
416 |
-
|
417 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-operators.php:11
|
418 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/child-conditions/condition-child-operators.php:11
|
419 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-operators.php:9
|
420 |
-
#: ../trunk/includes/admin/settings/conditions/condition-operators.php:11
|
421 |
-
msgid "Less or equal to "
|
422 |
-
msgstr "Nie więcej niż"
|
423 |
-
|
424 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-values.php:146
|
425 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/child-conditions/condition-child-values.php:48
|
426 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-values.php:129
|
427 |
-
#: ../trunk/includes/admin/settings/conditions/condition-values.php:146
|
428 |
-
msgid "In stock"
|
429 |
-
msgstr "W magazynie"
|
430 |
-
|
431 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-values.php:147
|
432 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/child-conditions/condition-child-values.php:49
|
433 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-values.php:130
|
434 |
-
#: ../trunk/includes/admin/settings/conditions/condition-values.php:147
|
435 |
-
msgid "Out of stock"
|
436 |
-
msgstr "Brak w magazynie"
|
437 |
-
|
438 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-values.php:156
|
439 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-values.php:139
|
440 |
-
#: ../trunk/includes/admin/settings/conditions/condition-values.php:156
|
441 |
-
msgid "Do not allow"
|
442 |
-
msgstr "Nie pozwalaj"
|
443 |
-
|
444 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-values.php:157
|
445 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-values.php:140
|
446 |
-
#: ../trunk/includes/admin/settings/conditions/condition-values.php:157
|
447 |
-
msgid "Allow, but notify customer"
|
448 |
-
msgstr "Pozwalaj, ale powiadom klienta"
|
449 |
-
|
450 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-values.php:158
|
451 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-values.php:141
|
452 |
-
#: ../trunk/includes/admin/settings/conditions/condition-values.php:158
|
453 |
-
msgid "Allow"
|
454 |
-
msgstr "Pozwalaj"
|
455 |
-
|
456 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/condition-values.php:221
|
457 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/child-conditions/condition-child-values.php:112
|
458 |
-
#: ../trunk/includes/admin/settings/conditions/condition-values.php:221
|
459 |
-
msgid "There are no options available"
|
460 |
-
msgstr "Opcje są niedostępne"
|
461 |
-
|
462 |
-
#: ../branches/child-conditions/includes/admin/settings/conditions/child-conditions/condition-child-conditions.php:10
|
463 |
-
msgid "Variation"
|
464 |
-
msgstr "Warianty"
|
465 |
-
|
466 |
-
#: ../branches/child-conditions/includes/admin/views/conditions-table.php:18
|
467 |
-
#: ../tags/1.0.1/includes/admin/views/conditions-table.php:15
|
468 |
-
#: ../trunk/includes/admin/views/conditions-table.php:18
|
469 |
-
msgid "Method conditions"
|
470 |
-
msgstr "Warunki metody"
|
471 |
-
|
472 |
-
#: ../branches/child-conditions/includes/admin/views/conditions-table.php:26
|
473 |
-
#: ../tags/1.0.1/includes/admin/views/conditions-table.php:23
|
474 |
-
#: ../trunk/includes/admin/views/conditions-table.php:26
|
475 |
-
msgid "Title"
|
476 |
-
msgstr "Nazwa"
|
477 |
-
|
478 |
-
#: ../branches/child-conditions/includes/admin/views/conditions-table.php:28
|
479 |
-
#: ../tags/1.0.1/includes/admin/views/conditions-table.php:25
|
480 |
-
#: ../trunk/includes/admin/views/conditions-table.php:28
|
481 |
-
msgid "Condition groups"
|
482 |
-
msgstr "Grupy warunków"
|
483 |
-
|
484 |
-
#: ../branches/child-conditions/includes/admin/views/conditions-table.php:40
|
485 |
-
#: ../branches/child-conditions/includes/admin/views/conditions-table.php:46
|
486 |
-
#: ../tags/1.0.1/includes/admin/views/conditions-table.php:38
|
487 |
-
#: ../tags/1.0.1/includes/admin/views/conditions-table.php:44
|
488 |
-
#: ../trunk/includes/admin/views/conditions-table.php:40
|
489 |
-
#: ../trunk/includes/admin/views/conditions-table.php:46
|
490 |
-
msgid "Edit Method"
|
491 |
-
msgstr "Zmień metodę"
|
492 |
-
|
493 |
-
#: ../branches/child-conditions/includes/admin/views/conditions-table.php:41
|
494 |
-
#: ../tags/1.0.1/includes/admin/views/conditions-table.php:39
|
495 |
-
#: ../trunk/includes/admin/views/conditions-table.php:41
|
496 |
-
msgid "Untitled"
|
497 |
-
msgstr "Nienazwane"
|
498 |
-
|
499 |
-
#: ../branches/child-conditions/includes/admin/views/conditions-table.php:47
|
500 |
-
#: ../tags/1.0.1/includes/admin/views/conditions-table.php:45
|
501 |
-
#: ../trunk/includes/admin/views/conditions-table.php:47
|
502 |
-
msgid "Edit"
|
503 |
-
msgstr "Edytuj"
|
504 |
-
|
505 |
-
#: ../branches/child-conditions/includes/admin/views/conditions-table.php:52
|
506 |
-
#: ../tags/1.0.1/includes/admin/views/conditions-table.php:50
|
507 |
-
#: ../trunk/includes/admin/views/conditions-table.php:52
|
508 |
-
msgid "Delete Method"
|
509 |
-
msgstr "Usuń metodę"
|
510 |
-
|
511 |
-
#: ../branches/child-conditions/includes/admin/views/conditions-table.php:53
|
512 |
-
#: ../tags/1.0.1/includes/admin/views/conditions-table.php:51
|
513 |
-
#: ../trunk/includes/admin/views/conditions-table.php:53
|
514 |
-
msgid "Delete"
|
515 |
-
msgstr "Usuń"
|
516 |
-
|
517 |
-
#: ../branches/child-conditions/includes/admin/views/conditions-table.php:68
|
518 |
-
#: ../tags/1.0.1/includes/admin/views/conditions-table.php:67
|
519 |
-
#: ../trunk/includes/admin/views/conditions-table.php:69
|
520 |
-
msgid "There are no Free Shipping conditions. Yet..."
|
521 |
-
msgstr "Nie ma jeszcze żadnych warunków darmowej wysyłki. Jeszcze..."
|
522 |
-
|
523 |
-
#: ../branches/child-conditions/includes/admin/views/conditions-table.php:77
|
524 |
-
#: ../tags/1.0.1/includes/admin/views/conditions-table.php:76
|
525 |
-
#: ../trunk/includes/admin/views/conditions-table.php:78
|
526 |
-
msgid "Add Free Shipping Method"
|
527 |
-
msgstr "Dodaj metodę darmowej wysyłki"
|
528 |
-
|
529 |
-
#: ../tags/1.0.1/includes/admin/settings/conditions/condition-descriptions.php:8
|
530 |
-
msgid "States are only available in the U.S."
|
531 |
-
msgstr "Stany dotyczą tylko USA"
|
532 |
-
|
533 |
-
#: ../tags/1.0.1/includes/admin/views/conditions-table.php:26
|
534 |
-
msgid "Author"
|
535 |
-
msgstr "Autor"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
languages/{wafs-en_US.mo → woocommerce-advanced-free-shipping-en_US.mo}
RENAMED
File without changes
|
languages/{wafs-en_US.po → woocommerce-advanced-free-shipping-en_US.po}
RENAMED
File without changes
|
languages/woocommerce-advanced-free-shipping-es_ES.mo
ADDED
Binary file
|
languages/woocommerce-advanced-free-shipping-es_ES.po
ADDED
@@ -0,0 +1,317 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: WooCommerce Advanced Free Shipping\n"
|
4 |
+
"POT-Creation-Date: 2014-04-24 19:17+0100\n"
|
5 |
+
"PO-Revision-Date: 2014-09-25 22:57-0500\n"
|
6 |
+
"Last-Translator: \n"
|
7 |
+
"Language-Team: Jeroen Sormani <info@jeroensormani.com>\n"
|
8 |
+
"Language: nl_NL\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Generator: Poedit 1.5.5\n"
|
13 |
+
"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
|
14 |
+
"X-Poedit-Basepath: ../\n"
|
15 |
+
"X-Poedit-SearchPath-0: ..\n"
|
16 |
+
|
17 |
+
#: ../woocommerce-advanced-free-shipping/includes/class-wafs-ajax.php:48
|
18 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/meta-box-conditions.php:29
|
19 |
+
msgid "Or match all of the following rules to allow free shipping:"
|
20 |
+
msgstr "O coincidir todas las siguientes reglas para permitir el envío gratis:"
|
21 |
+
|
22 |
+
#: ../woocommerce-advanced-free-shipping/includes/class-wafs-ajax.php:55
|
23 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/meta-box-conditions.php:39
|
24 |
+
msgid "Or"
|
25 |
+
msgstr "Ó"
|
26 |
+
|
27 |
+
#: ../woocommerce-advanced-free-shipping/includes/class-wafs-method.php:18
|
28 |
+
msgid "Advanced Free Shipping"
|
29 |
+
msgstr "Envío Gratis Avanzado"
|
30 |
+
|
31 |
+
#: ../woocommerce-advanced-free-shipping/includes/class-wafs-method.php:19
|
32 |
+
msgid "Configure WooCommerce Advanced Free Shipping"
|
33 |
+
msgstr "Configurar el envío gratis avanzado para WooCommerce"
|
34 |
+
|
35 |
+
#: ../woocommerce-advanced-free-shipping/includes/class-wafs-method.php:128
|
36 |
+
msgid "Enable/Disable"
|
37 |
+
msgstr "Activar / Desactivar"
|
38 |
+
|
39 |
+
#: ../woocommerce-advanced-free-shipping/includes/class-wafs-method.php:130
|
40 |
+
msgid "Enable Advanced Free Shipping"
|
41 |
+
msgstr "Habilitar Envío Gratis Avanzado"
|
42 |
+
|
43 |
+
#: ../woocommerce-advanced-free-shipping/includes/class-wafs-method.php:134
|
44 |
+
msgid "Hide other shipping"
|
45 |
+
msgstr "Ocultar otros envíos"
|
46 |
+
|
47 |
+
#: ../woocommerce-advanced-free-shipping/includes/class-wafs-method.php:136
|
48 |
+
msgid "Hide other shipping methods when free shipping is available"
|
49 |
+
msgstr ""
|
50 |
+
"Ocultar otros métodos de envío cuando Envío Gratis Avanzado está disponible"
|
51 |
+
|
52 |
+
#: ../woocommerce-advanced-free-shipping/includes/class-wafs-method.php:197
|
53 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/views/conditions-table.php:56
|
54 |
+
msgid "Free Shipping"
|
55 |
+
msgstr "Envío Gratis"
|
56 |
+
|
57 |
+
#: ../woocommerce-advanced-free-shipping/includes/class-wafs-post-type.php:39
|
58 |
+
msgid "Advanced Free Shipping methods"
|
59 |
+
msgstr "Métodos de Envío Gratis Avanzado"
|
60 |
+
|
61 |
+
#: ../woocommerce-advanced-free-shipping/includes/class-wafs-post-type.php:40
|
62 |
+
msgid "Advanced Free Shipping method"
|
63 |
+
msgstr "Método de Envío Gratis Avanzado"
|
64 |
+
|
65 |
+
#: ../woocommerce-advanced-free-shipping/includes/class-wafs-post-type.php:41
|
66 |
+
msgid "Add New"
|
67 |
+
msgstr "Añadir Nuevo"
|
68 |
+
|
69 |
+
#: ../woocommerce-advanced-free-shipping/includes/class-wafs-post-type.php:42
|
70 |
+
msgid "Add New Advanced Free Shipping method"
|
71 |
+
msgstr "Añadir Nuevo método de Envío Gratis Avanzado"
|
72 |
+
|
73 |
+
#: ../woocommerce-advanced-free-shipping/includes/class-wafs-post-type.php:43
|
74 |
+
msgid "Edit Advanced Free Shipping method"
|
75 |
+
msgstr "Editar método de Envío Gratis Avanzado"
|
76 |
+
|
77 |
+
#: ../woocommerce-advanced-free-shipping/includes/class-wafs-post-type.php:44
|
78 |
+
msgid "New Advanced Free Shipping method"
|
79 |
+
msgstr "Nuevo método de Envío Gratis Avanzado"
|
80 |
+
|
81 |
+
#: ../woocommerce-advanced-free-shipping/includes/class-wafs-post-type.php:45
|
82 |
+
msgid "View Advanced Free Shipping method"
|
83 |
+
msgstr "Ver método de Envío Gratis Avanzado"
|
84 |
+
|
85 |
+
#: ../woocommerce-advanced-free-shipping/includes/class-wafs-post-type.php:46
|
86 |
+
msgid "Search Advanced Free Shipping methods"
|
87 |
+
msgstr "Buscar métodos de Envío Gratis Avanzado"
|
88 |
+
|
89 |
+
#: ../woocommerce-advanced-free-shipping/includes/class-wafs-post-type.php:47
|
90 |
+
msgid "No Advanced Free Shipping methods"
|
91 |
+
msgstr "No hay métodos de Envío Gratis Avanzado"
|
92 |
+
|
93 |
+
#: ../woocommerce-advanced-free-shipping/includes/class-wafs-post-type.php:48
|
94 |
+
msgid "No Advanced Free Shipping methods found in Trash"
|
95 |
+
msgstr "No hay métodos de Envío Gratis Avanzado en la papelera"
|
96 |
+
|
97 |
+
#: ../woocommerce-advanced-free-shipping/includes/class-wafs-post-type.php:74
|
98 |
+
msgid "Advanced Free Shipping conditions"
|
99 |
+
msgstr "Condiciones de Envío Gratis Avanzado"
|
100 |
+
|
101 |
+
#: ../woocommerce-advanced-free-shipping/includes/class-wafs-post-type.php:75
|
102 |
+
msgid "Shipping settings"
|
103 |
+
msgstr "Configuración de Envio"
|
104 |
+
|
105 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/meta-box-conditions.php:20
|
106 |
+
msgid "Match all of the following rules to allow free shipping:"
|
107 |
+
msgstr "Coincidir todas las siguientes reglas para permitir el envío gratis:"
|
108 |
+
|
109 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/meta-box-conditions.php:54
|
110 |
+
msgid "Add 'Or' group"
|
111 |
+
msgstr "Añadir 'O' agrupar"
|
112 |
+
|
113 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/meta-box-settings.php:21
|
114 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/views/conditions-table.php:24
|
115 |
+
msgid "Shipping title"
|
116 |
+
msgstr "Título del envío"
|
117 |
+
|
118 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/meta-box-settings.php:23
|
119 |
+
msgid "e.g. Free Shipping"
|
120 |
+
msgstr "por ejemplo, Envío Gratuito"
|
121 |
+
|
122 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-conditions.php:6
|
123 |
+
msgid "Cart"
|
124 |
+
msgstr "Carrito de compras"
|
125 |
+
|
126 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-conditions.php:7
|
127 |
+
msgid "Subtotal"
|
128 |
+
msgstr "Subtotal"
|
129 |
+
|
130 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-conditions.php:8
|
131 |
+
msgid "Subtotal ex. taxes"
|
132 |
+
msgstr "Subtotal excluidos impuestos"
|
133 |
+
|
134 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-conditions.php:9
|
135 |
+
msgid "Tax"
|
136 |
+
msgstr "Impuesto"
|
137 |
+
|
138 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-conditions.php:10
|
139 |
+
msgid "Quantity"
|
140 |
+
msgstr "Cantidad"
|
141 |
+
|
142 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-conditions.php:11
|
143 |
+
msgid "Contains product"
|
144 |
+
msgstr "Contiene producto"
|
145 |
+
|
146 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-conditions.php:12
|
147 |
+
msgid "Coupon"
|
148 |
+
msgstr "Cupón"
|
149 |
+
|
150 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-conditions.php:14
|
151 |
+
msgid "User Details"
|
152 |
+
msgstr "Información del usuario"
|
153 |
+
|
154 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-conditions.php:15
|
155 |
+
msgid "Zipcode"
|
156 |
+
msgstr "Codigo Postal"
|
157 |
+
|
158 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-conditions.php:16
|
159 |
+
msgid "City"
|
160 |
+
msgstr "Ciudad"
|
161 |
+
|
162 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-conditions.php:17
|
163 |
+
msgid "Country"
|
164 |
+
msgstr "País"
|
165 |
+
|
166 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-conditions.php:18
|
167 |
+
msgid "User role"
|
168 |
+
msgstr "Rol de usuario"
|
169 |
+
|
170 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-conditions.php:20
|
171 |
+
msgid "Product"
|
172 |
+
msgstr "Producto"
|
173 |
+
|
174 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-conditions.php:21
|
175 |
+
msgid "Width"
|
176 |
+
msgstr "Ancho"
|
177 |
+
|
178 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-conditions.php:22
|
179 |
+
msgid "Height"
|
180 |
+
msgstr "Alto"
|
181 |
+
|
182 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-conditions.php:23
|
183 |
+
msgid "Length"
|
184 |
+
msgstr "Largo"
|
185 |
+
|
186 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-conditions.php:24
|
187 |
+
msgid "Weight"
|
188 |
+
msgstr "Peso"
|
189 |
+
|
190 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-conditions.php:25
|
191 |
+
msgid "Stock"
|
192 |
+
msgstr "Inventario"
|
193 |
+
|
194 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-conditions.php:26
|
195 |
+
msgid "Stock status"
|
196 |
+
msgstr "Estado del inventario"
|
197 |
+
|
198 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-conditions.php:27
|
199 |
+
msgid "Backorders"
|
200 |
+
msgstr "Pedidos pendientes"
|
201 |
+
|
202 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-conditions.php:28
|
203 |
+
msgid "Category"
|
204 |
+
msgstr "Categoría"
|
205 |
+
|
206 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-descriptions.php:8
|
207 |
+
msgid "Weight calculated on all the cart contents"
|
208 |
+
msgstr "Peso calculado sobre todos los contenidos del carrito"
|
209 |
+
|
210 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-descriptions.php:9
|
211 |
+
msgid "Compared to lengthiest product in cart"
|
212 |
+
msgstr "Comparado con los productos más largos del carrito"
|
213 |
+
|
214 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-descriptions.php:10
|
215 |
+
msgid "Compared to widest product in cart"
|
216 |
+
msgstr "Comparado con los productos más anchos del carrito"
|
217 |
+
|
218 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-descriptions.php:11
|
219 |
+
msgid "Compared to highest product in cart"
|
220 |
+
msgstr "Comparado con el producto más alto del carrito"
|
221 |
+
|
222 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-descriptions.php:12
|
223 |
+
msgid "All products in cart must match stock status"
|
224 |
+
msgstr "Todos los productos en la cesta debe coincidir con el estado del stock"
|
225 |
+
|
226 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-descriptions.php:13
|
227 |
+
msgid "All products in cart must match backorder"
|
228 |
+
msgstr "Todos los productos en el carrito deben coincidir con pedido pendiente"
|
229 |
+
|
230 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-descriptions.php:14
|
231 |
+
msgid "All products in cart must match category"
|
232 |
+
msgstr "Todos los productos en el carrito deben coincidir con la categoría"
|
233 |
+
|
234 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-descriptions.php:15
|
235 |
+
msgid "Cart must contain one of this product"
|
236 |
+
msgstr "El carrito debe contener uno de estos productos"
|
237 |
+
|
238 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-operators.php:6
|
239 |
+
msgid "Equal to"
|
240 |
+
msgstr "Igual a"
|
241 |
+
|
242 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-operators.php:7
|
243 |
+
msgid "Not equal to"
|
244 |
+
msgstr "No es igual a"
|
245 |
+
|
246 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-operators.php:8
|
247 |
+
msgid "Greater or equal to"
|
248 |
+
msgstr "Mayor o igual a"
|
249 |
+
|
250 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-operators.php:9
|
251 |
+
msgid "Less or equal to "
|
252 |
+
msgstr "Menor o igual que "
|
253 |
+
|
254 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-values.php:122
|
255 |
+
msgid "In stock"
|
256 |
+
msgstr "En inventario"
|
257 |
+
|
258 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-values.php:123
|
259 |
+
msgid "Out of stock"
|
260 |
+
msgstr "Sin inventario"
|
261 |
+
|
262 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-values.php:132
|
263 |
+
msgid "Do not allow"
|
264 |
+
msgstr "No permita que"
|
265 |
+
|
266 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-values.php:133
|
267 |
+
msgid "Allow, but notify customer"
|
268 |
+
msgstr "Permitir, pero notificar al cliente"
|
269 |
+
|
270 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/settings/conditions/condition-values.php:134
|
271 |
+
msgid "Allow"
|
272 |
+
msgstr "Permitir"
|
273 |
+
|
274 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/views/conditions-table.php:15
|
275 |
+
msgid "Method conditions"
|
276 |
+
msgstr "Condiciones del método"
|
277 |
+
|
278 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/views/conditions-table.php:23
|
279 |
+
msgid "Title"
|
280 |
+
msgstr "Título"
|
281 |
+
|
282 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/views/conditions-table.php:25
|
283 |
+
msgid "Condition groups"
|
284 |
+
msgstr "Grupos de condiciones"
|
285 |
+
|
286 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/views/conditions-table.php:26
|
287 |
+
msgid "Author"
|
288 |
+
msgstr "Autor"
|
289 |
+
|
290 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/views/conditions-table.php:38
|
291 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/views/conditions-table.php:44
|
292 |
+
msgid "Edit Method"
|
293 |
+
msgstr "Editar método"
|
294 |
+
|
295 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/views/conditions-table.php:39
|
296 |
+
msgid "Untitled"
|
297 |
+
msgstr "Sin título"
|
298 |
+
|
299 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/views/conditions-table.php:45
|
300 |
+
msgid "Edit"
|
301 |
+
msgstr "Editar"
|
302 |
+
|
303 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/views/conditions-table.php:50
|
304 |
+
msgid "Delete Method"
|
305 |
+
msgstr "Borrar método"
|
306 |
+
|
307 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/views/conditions-table.php:51
|
308 |
+
msgid "Delete"
|
309 |
+
msgstr "Eliminar"
|
310 |
+
|
311 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/views/conditions-table.php:67
|
312 |
+
msgid "There are no Free Shipping conditions. Yet..."
|
313 |
+
msgstr "No hay condiciones de envío gratis. Aún..."
|
314 |
+
|
315 |
+
#: ../woocommerce-advanced-free-shipping/includes/admin/views/conditions-table.php:76
|
316 |
+
msgid "Add Free Shipping Method"
|
317 |
+
msgstr "Añadir método de envío gratis"
|
readme.txt
CHANGED
@@ -4,14 +4,14 @@ Donate link: http://www.jeroensormani.com/donate/
|
|
4 |
Tags: woocommerce, shipping, woocommerce shipping, woocommerce free shipping, woocommerce free, woocommerce advanced free shipping, wc free shipping, wc shipping, advanced shipping, pro shipping, table rate shipping, country shipping, free shipping
|
5 |
Requires at least: 3.6
|
6 |
Tested up to: 3.9
|
7 |
-
Stable tag: 1.0.
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
11 |
WooCommerce Advanced Free Shipping is an plugin which allows you to set up advanced free shipping conditions.
|
12 |
|
13 |
== Description ==
|
14 |
-
WooCommerce Advanced Free Shipping is an plugin which allows you to set up advanced free shipping conditions.
|
15 |
|
16 |
*Conditions like:*
|
17 |
|
@@ -28,9 +28,9 @@ WooCommerce Advanced Free Shipping is an plugin which allows you to set up advan
|
|
28 |
|
29 |
**Translations, feature requests, ratings and donations are welcome and appreciated!**
|
30 |
|
31 |
-
|
32 |
-
- Polish [(Kamil)](http://wordpress.org/support/profile/gabinetcouk)
|
33 |
|
|
|
34 |
|
35 |
== Installation ==
|
36 |
|
@@ -46,6 +46,26 @@ WooCommerce Advanced Free Shipping is an plugin which allows you to set up advan
|
|
46 |
|
47 |
== Changelog ==
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
= 1.0.2 = 07/03/2014
|
50 |
* Added - support for comma separated zipcodes
|
51 |
* Added - filter for condition values
|
4 |
Tags: woocommerce, shipping, woocommerce shipping, woocommerce free shipping, woocommerce free, woocommerce advanced free shipping, wc free shipping, wc shipping, advanced shipping, pro shipping, table rate shipping, country shipping, free shipping
|
5 |
Requires at least: 3.6
|
6 |
Tested up to: 3.9
|
7 |
+
Stable tag: 1.0.3
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
11 |
WooCommerce Advanced Free Shipping is an plugin which allows you to set up advanced free shipping conditions.
|
12 |
|
13 |
== Description ==
|
14 |
+
WooCommerce Advanced Free Shipping is an plugin which allows you to set up advanced free shipping conditions.
|
15 |
|
16 |
*Conditions like:*
|
17 |
|
28 |
|
29 |
**Translations, feature requests, ratings and donations are welcome and appreciated!**
|
30 |
|
31 |
+
** Translations **
|
|
|
32 |
|
33 |
+
- Spanish [(Andres Felipe)](https://wordpress.org/support/profile/naturalworldstm)
|
34 |
|
35 |
== Installation ==
|
36 |
|
46 |
|
47 |
== Changelog ==
|
48 |
|
49 |
+
= 1.0.3 =
|
50 |
+
* Improvement - Customized user messages when saving shipping method
|
51 |
+
* Improvement - Updated some comments to comment standards
|
52 |
+
* Improvement - Overview not showing all actions when hovering only one
|
53 |
+
* Improvement - Added ABSPATH check to each file
|
54 |
+
* Improvement - Improved code comments
|
55 |
+
* Improvement - Remove globals, use WAFS() function now
|
56 |
+
* Improvement - Zipcodes are now better detected (only integer values)
|
57 |
+
* Improvement - Load textdomains
|
58 |
+
* Improvement - Add compatibility for custom value fields
|
59 |
+
* Improvement - Add world wide state support
|
60 |
+
* Fix - No notice on shipping title in DEBUG mode
|
61 |
+
* Fix - Loading icon on sub directory websites
|
62 |
+
* Fix - Condition description didn't show sometimes
|
63 |
+
* Fix - 'Category' - 'Not equal to' error
|
64 |
+
* Fix - Showing drafts in overview
|
65 |
+
* Fix - Change option name from ‚hide_other_shipping_when_available’ to ‚’hide_other_shipping
|
66 |
+
* Removed - Author from overview, who needs that?
|
67 |
+
|
68 |
+
|
69 |
= 1.0.2 = 07/03/2014
|
70 |
* Added - support for comma separated zipcodes
|
71 |
* Added - filter for condition values
|
woocommerce-advanced-free-shipping.php
CHANGED
@@ -4,10 +4,10 @@ Plugin Name: Woocommerce Advanced Free Shipping
|
|
4 |
Plugin URI: http://www.jeroensormani.com/
|
5 |
Donate link: http://www.jeroensormani.com/donate/
|
6 |
Description: WooCommerce Advanced Free Shipping is an plugin which allows you to set up advanced free shipping conditions.
|
7 |
-
Version: 1.0.
|
8 |
Author: Jeroen Sormani
|
9 |
Author URI: http://www.jeroensormani.com/
|
10 |
-
Text Domain:
|
11 |
|
12 |
* Copyright Jeroen Sormani
|
13 |
*
|
@@ -29,109 +29,256 @@ Text Domain: wafs
|
|
29 |
* along with WordPress. If not, see <http://www.gnu.org/licenses/>.
|
30 |
*/
|
31 |
|
32 |
-
|
33 |
/**
|
34 |
-
*
|
35 |
*
|
36 |
-
*
|
37 |
*
|
38 |
-
*
|
39 |
-
*
|
40 |
-
*
|
41 |
*/
|
42 |
-
class
|
43 |
|
44 |
|
45 |
/**
|
46 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
*/
|
48 |
public function __construct() {
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
return;
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
}
|
57 |
-
|
58 |
-
|
59 |
/**
|
60 |
-
*
|
61 |
*
|
62 |
-
* Initialize all hooks
|
|
|
|
|
63 |
*/
|
64 |
-
public function
|
65 |
-
|
66 |
// Initialize shipping method class
|
67 |
add_action( 'woocommerce_shipping_init', array( $this, 'wafs_free_shipping' ) );
|
68 |
-
|
69 |
// Add shipping method
|
70 |
add_action( 'woocommerce_shipping_methods', array( $this, 'wafs_add_shipping_method' ) );
|
71 |
-
|
72 |
// Register post type
|
73 |
add_action( 'init', array( $this, 'wafs_register_post_type' ) );
|
74 |
-
|
75 |
// Enqueue scripts
|
76 |
add_action( 'admin_enqueue_scripts', array( $this, 'wafs_admin_enqueue_scripts' ) );
|
77 |
-
|
78 |
}
|
79 |
-
|
80 |
-
|
81 |
/**
|
82 |
-
*
|
|
|
|
|
83 |
*
|
84 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
*/
|
86 |
public function wafs_free_shipping() {
|
87 |
-
|
88 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-wafs-method.php';
|
89 |
-
|
90 |
}
|
91 |
-
|
92 |
-
|
93 |
/**
|
94 |
-
*
|
|
|
|
|
95 |
*
|
96 |
-
*
|
97 |
*/
|
98 |
public function wafs_add_shipping_method( $methods ) {
|
99 |
-
|
100 |
-
if ( class_exists( 'Wafs_Free_Shipping_Method' ) )
|
101 |
$methods[] = 'Wafs_Free_Shipping_Method';
|
|
|
102 |
|
103 |
return $methods;
|
104 |
-
|
105 |
}
|
106 |
-
|
107 |
-
|
108 |
/**
|
109 |
-
*
|
|
|
|
|
|
|
|
|
110 |
*/
|
111 |
public function wafs_register_post_type() {
|
112 |
|
113 |
/**
|
114 |
-
* Require file with settings
|
115 |
*/
|
116 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-wafs-post-type.php';
|
117 |
|
118 |
}
|
119 |
-
|
|
|
120 |
/**
|
121 |
-
* Enqueue
|
122 |
-
|
|
|
|
|
123 |
public function wafs_admin_enqueue_scripts() {
|
124 |
-
|
125 |
-
wp_enqueue_style( 'wafs-style', plugins_url( 'assets/css/admin-style.css', __FILE__ ) );
|
126 |
-
wp_enqueue_script( 'wafs-js', plugins_url( 'assets/js/wafs-js.js', __FILE__ ), array( 'jquery' ),
|
127 |
-
|
128 |
}
|
129 |
-
|
|
|
130 |
}
|
131 |
-
|
132 |
|
133 |
/**
|
134 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
*/
|
136 |
-
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
Plugin URI: http://www.jeroensormani.com/
|
5 |
Donate link: http://www.jeroensormani.com/donate/
|
6 |
Description: WooCommerce Advanced Free Shipping is an plugin which allows you to set up advanced free shipping conditions.
|
7 |
+
Version: 1.0.3
|
8 |
Author: Jeroen Sormani
|
9 |
Author URI: http://www.jeroensormani.com/
|
10 |
+
Text Domain: woocommerce-advanced-free-shipping
|
11 |
|
12 |
* Copyright Jeroen Sormani
|
13 |
*
|
29 |
* along with WordPress. If not, see <http://www.gnu.org/licenses/>.
|
30 |
*/
|
31 |
|
32 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
33 |
/**
|
34 |
+
* Class Woocommerce_Advanced_Free_Shipping
|
35 |
*
|
36 |
+
* Main WAFS class, add filters and handling all other files
|
37 |
*
|
38 |
+
* @class Woocommerce_Advanced_Free_Shipping
|
39 |
+
* @version 1.0.0
|
40 |
+
* @author Jeroen Sormani
|
41 |
*/
|
42 |
+
class WooCommerce_Advanced_Free_Shipping {
|
43 |
|
44 |
|
45 |
/**
|
46 |
+
* Version.
|
47 |
+
*
|
48 |
+
* @since 1.0.3
|
49 |
+
* @var string $version Plugin version number.
|
50 |
+
*/
|
51 |
+
public $version = '1.0.3';
|
52 |
+
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Instace of WooCommerce_Advanced_Shipping.
|
56 |
+
*
|
57 |
+
* @since 1.0.3
|
58 |
+
* @access private
|
59 |
+
* @var object $instance The instance of WAS.
|
60 |
+
*/
|
61 |
+
private static $instance;
|
62 |
+
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Constructor.
|
66 |
+
*
|
67 |
+
* @since 1.0.0
|
68 |
*/
|
69 |
public function __construct() {
|
70 |
+
|
71 |
+
if ( ! function_exists( 'is_plugin_active_for_network' ) )
|
72 |
+
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
73 |
+
|
74 |
+
// Check if WooCommerce is active
|
75 |
+
if ( ! in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) :
|
76 |
+
if ( ! is_plugin_active_for_network( 'woocommerce/woocommerce.php' ) ) :
|
77 |
+
return;
|
78 |
+
endif;
|
79 |
+
endif;
|
80 |
+
|
81 |
+
// Check if there needs to be any functional updates
|
82 |
+
$this->update();
|
83 |
+
|
84 |
+
// Initialize plugin parts
|
85 |
+
$this->init();
|
86 |
+
|
87 |
+
}
|
88 |
+
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Instance.
|
92 |
+
*
|
93 |
+
* An global instance of the class. Used to retrieve the instance
|
94 |
+
* to use on other files/plugins/themes.
|
95 |
+
*
|
96 |
+
* @since 1.1.0
|
97 |
+
*
|
98 |
+
* @return object Instance of the class.
|
99 |
+
*/
|
100 |
+
public static function instance() {
|
101 |
+
|
102 |
+
if ( is_null( self::$instance ) ) {
|
103 |
+
self::$instance = new self();
|
104 |
+
}
|
105 |
+
|
106 |
+
return self::$instance;
|
107 |
+
|
108 |
+
}
|
109 |
+
|
110 |
+
|
111 |
+
public function update() {
|
112 |
+
|
113 |
+
$db_version = get_option( 'wafs_plugin_version', '1.0.0' );
|
114 |
+
|
115 |
+
// Stop current version is up to date
|
116 |
+
if ( $db_version >= $this->version ) :
|
117 |
return;
|
118 |
+
endif;
|
119 |
+
|
120 |
+
// Update functions for 1.0.3
|
121 |
+
if ( version_compare( '1.0.3', $db_version ) ) :
|
122 |
+
|
123 |
+
$wafs_method_settings = get_option( 'woocommerce_advanced_free_shipping_settings' );
|
124 |
+
if ( isset( $wafs_method_settings['hide_other_shipping_when_available'] ) ) :
|
125 |
+
$wafs_method_settings['hide_other_shipping'] = $wafs_method_settings['hide_other_shipping_when_available'];
|
126 |
+
update_option( 'woocommerce_advanced_free_shipping_settings', $wafs_method_settings );
|
127 |
+
endif;
|
128 |
+
|
129 |
+
endif;
|
130 |
+
|
131 |
+
update_option( 'wafs_plugin_version', $this->version );
|
132 |
+
|
133 |
+
|
134 |
+
}
|
135 |
+
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Init.
|
139 |
+
*
|
140 |
+
* Initialize plugin parts.
|
141 |
+
*
|
142 |
+
* @since 1.1.0
|
143 |
+
*/
|
144 |
+
public function init() {
|
145 |
+
|
146 |
+
// Add hooks/filters
|
147 |
+
$this->hooks();
|
148 |
+
|
149 |
+
// Load textdomain
|
150 |
+
$this->load_textdomain();
|
151 |
+
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Require matching conditions hooks.
|
155 |
+
*/
|
156 |
+
require_once plugin_dir_path( __FILE__ ) . '/includes/class-wafs-match-conditions.php';
|
157 |
|
158 |
}
|
159 |
+
|
160 |
+
|
161 |
/**
|
162 |
+
* Hooks.
|
163 |
*
|
164 |
+
* Initialize all class hooks.
|
165 |
+
*
|
166 |
+
* @since 1.0.0
|
167 |
*/
|
168 |
+
public function hooks() {
|
169 |
+
|
170 |
// Initialize shipping method class
|
171 |
add_action( 'woocommerce_shipping_init', array( $this, 'wafs_free_shipping' ) );
|
172 |
+
|
173 |
// Add shipping method
|
174 |
add_action( 'woocommerce_shipping_methods', array( $this, 'wafs_add_shipping_method' ) );
|
175 |
+
|
176 |
// Register post type
|
177 |
add_action( 'init', array( $this, 'wafs_register_post_type' ) );
|
178 |
+
|
179 |
// Enqueue scripts
|
180 |
add_action( 'admin_enqueue_scripts', array( $this, 'wafs_admin_enqueue_scripts' ) );
|
181 |
+
|
182 |
}
|
183 |
+
|
184 |
+
|
185 |
/**
|
186 |
+
* Textdomain.
|
187 |
+
*
|
188 |
+
* Load the textdomain based on WP language.
|
189 |
*
|
190 |
+
* @since 1.1.0
|
191 |
+
*/
|
192 |
+
public function load_textdomain() {
|
193 |
+
|
194 |
+
// Load textdomain
|
195 |
+
load_plugin_textdomain( 'woocommerce-advanced-free-shipping', false, basename( dirname( __FILE__ ) ) . '/languages' );
|
196 |
+
|
197 |
+
}
|
198 |
+
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Shipping method.
|
202 |
+
*
|
203 |
+
* Include the WooCommerce shipping method class.
|
204 |
+
*
|
205 |
+
* @since 1.0.0
|
206 |
*/
|
207 |
public function wafs_free_shipping() {
|
208 |
+
|
209 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-wafs-method.php';
|
210 |
+
|
211 |
}
|
212 |
+
|
213 |
+
|
214 |
/**
|
215 |
+
* Add shipping method.
|
216 |
+
*
|
217 |
+
* Add shipping method to WooCommerce.
|
218 |
*
|
219 |
+
* @since 1.0.0
|
220 |
*/
|
221 |
public function wafs_add_shipping_method( $methods ) {
|
222 |
+
|
223 |
+
if ( class_exists( 'Wafs_Free_Shipping_Method' ) ) :
|
224 |
$methods[] = 'Wafs_Free_Shipping_Method';
|
225 |
+
endif;
|
226 |
|
227 |
return $methods;
|
228 |
+
|
229 |
}
|
230 |
+
|
231 |
+
|
232 |
/**
|
233 |
+
* WAFS post type.
|
234 |
+
*
|
235 |
+
* Class to handle post type and everything around that.
|
236 |
+
*
|
237 |
+
* @since 1.0.0
|
238 |
*/
|
239 |
public function wafs_register_post_type() {
|
240 |
|
241 |
/**
|
242 |
+
* Require file with settings.
|
243 |
*/
|
244 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-wafs-post-type.php';
|
245 |
|
246 |
}
|
247 |
+
|
248 |
+
|
249 |
/**
|
250 |
+
* Enqueue scripts.
|
251 |
+
*
|
252 |
+
* @since 1.0.0
|
253 |
+
*/
|
254 |
public function wafs_admin_enqueue_scripts() {
|
255 |
+
|
256 |
+
wp_enqueue_style( 'wafs-style', plugins_url( 'assets/css/admin-style.css', __FILE__ ), array(), $this->version );
|
257 |
+
wp_enqueue_script( 'wafs-js', plugins_url( 'assets/js/wafs-js.js', __FILE__ ), array( 'jquery' ), $this->version, true );
|
258 |
+
|
259 |
}
|
260 |
+
|
261 |
+
|
262 |
}
|
263 |
+
|
264 |
|
265 |
/**
|
266 |
+
* The main function responsible for returning the WooCommerce_Advanced_Free_Shipping object.
|
267 |
+
*
|
268 |
+
* Use this function like you would a global variable, except without needing to declare the global.
|
269 |
+
*
|
270 |
+
* Example: <?php WAFS()->method_name(); ?>
|
271 |
+
*
|
272 |
+
* @since 1.1.0
|
273 |
+
*
|
274 |
+
* @return object WooCommerce_Advanced_Free_Shipping class object.
|
275 |
*/
|
276 |
+
if ( ! function_exists( 'WAFS' ) ) :
|
277 |
+
|
278 |
+
function WAFS() {
|
279 |
+
return WooCommerce_Advanced_Free_Shipping::instance();
|
280 |
+
}
|
281 |
+
|
282 |
+
endif;
|
283 |
+
|
284 |
+
WAFS();
|