Version Description
- 2017-04-03 =
- Added support for upcoming WooCommerce 3.0
- Dropped support for WooCommerce below 2.5 (the plugin may still work with older versions but we do not declare official support)
Download this release
Release Info
Developer | wpdesk |
Plugin | Flexible Checkout Fields for WooCommerce – WooCommerce Checkout Manager |
Version | 1.5 |
Comparing to | |
See all releases |
Code changes from version 1.4 to 1.5
- flexible-checkout-fields.php +7 -5
- inc/wpdesk-woo27-functions.php +377 -0
- readme.txt +7 -3
flexible-checkout-fields.php
CHANGED
@@ -3,13 +3,13 @@
|
|
3 |
Plugin Name: Flexible Checkout Fields
|
4 |
Plugin URI: https://www.wpdesk.net/products/flexible-checkout-fields-pro-woocommerce/
|
5 |
Description: Manage your WooCommerce checkout fields. Change order, labels, placeholders and add new fields.
|
6 |
-
Version: 1.
|
7 |
Author: WP Desk
|
8 |
Author URI: https://www.wpdesk.net/
|
9 |
Text Domain: flexible-checkout-fields
|
10 |
Domain Path: /lang/
|
11 |
|
12 |
-
Copyright
|
13 |
|
14 |
This program is free software; you can redistribute it and/or modify
|
15 |
it under the terms of the GNU General Public License as published by
|
@@ -49,6 +49,8 @@
|
|
49 |
|
50 |
require_once('class/inspireCheckoutFieldsSettings.php');
|
51 |
|
|
|
|
|
52 |
class inspireCheckoutFields extends inspire_Plugin3 {
|
53 |
private static $_oInstance = false;
|
54 |
|
@@ -542,7 +544,7 @@
|
|
542 |
&& ( ( isset( $field['custom_field'] ) && $field['custom_field'] == 1 ) || in_array( $field['name'], array('billing_phone', 'billing_email' ) ) )
|
543 |
&& ( empty( $field['type'] ) || ( !empty( $checkout_field_type[$field['type']] ) && empty( $checkout_field_type[$field['type']]['exclude_in_admin'] ) ) )
|
544 |
) {
|
545 |
-
if ( $value =
|
546 |
if ( isset( $field['type'] ) ) {
|
547 |
$value = apply_filters( 'flexible_checkout_fields_print_value', $value, $field );
|
548 |
$return[] = '<b>'.stripslashes( wpdesk__( $field['label'], 'flexible-checkout-fields' ) ).'</b>: '.$value;
|
@@ -632,7 +634,7 @@
|
|
632 |
if ( isset( $type ) && is_array( $type ) ) {
|
633 |
foreach ( $type as $field ) {
|
634 |
if ( isset( $field['visible'] ) && $field['visible'] == 0 && isset($field['custom_field']) && $field['custom_field'] == 1 ){
|
635 |
-
if($value =
|
636 |
if ( !empty( $checkout_field_type[$field['type']]['has_options'] ) ) {
|
637 |
$array_options = explode("\n", $field['option']);
|
638 |
if(!empty($array_options)){
|
@@ -706,7 +708,7 @@
|
|
706 |
}
|
707 |
|
708 |
public function addCustomFieldsToEmail($order) {
|
709 |
-
$this -> addCustomFieldsToReview($order
|
710 |
}
|
711 |
|
712 |
public function addCustomFieldsBillingFields($fields) {
|
3 |
Plugin Name: Flexible Checkout Fields
|
4 |
Plugin URI: https://www.wpdesk.net/products/flexible-checkout-fields-pro-woocommerce/
|
5 |
Description: Manage your WooCommerce checkout fields. Change order, labels, placeholders and add new fields.
|
6 |
+
Version: 1.5
|
7 |
Author: WP Desk
|
8 |
Author URI: https://www.wpdesk.net/
|
9 |
Text Domain: flexible-checkout-fields
|
10 |
Domain Path: /lang/
|
11 |
|
12 |
+
Copyright 2017 WP Desk Ltd.
|
13 |
|
14 |
This program is free software; you can redistribute it and/or modify
|
15 |
it under the terms of the GNU General Public License as published by
|
49 |
|
50 |
require_once('class/inspireCheckoutFieldsSettings.php');
|
51 |
|
52 |
+
require_once('inc/wpdesk-woo27-functions.php');
|
53 |
+
|
54 |
class inspireCheckoutFields extends inspire_Plugin3 {
|
55 |
private static $_oInstance = false;
|
56 |
|
544 |
&& ( ( isset( $field['custom_field'] ) && $field['custom_field'] == 1 ) || in_array( $field['name'], array('billing_phone', 'billing_email' ) ) )
|
545 |
&& ( empty( $field['type'] ) || ( !empty( $checkout_field_type[$field['type']] ) && empty( $checkout_field_type[$field['type']]['exclude_in_admin'] ) ) )
|
546 |
) {
|
547 |
+
if ( $value = wpdesk_get_order_meta( $order, '_'.$field['name'] , true ) ) {
|
548 |
if ( isset( $field['type'] ) ) {
|
549 |
$value = apply_filters( 'flexible_checkout_fields_print_value', $value, $field );
|
550 |
$return[] = '<b>'.stripslashes( wpdesk__( $field['label'], 'flexible-checkout-fields' ) ).'</b>: '.$value;
|
634 |
if ( isset( $type ) && is_array( $type ) ) {
|
635 |
foreach ( $type as $field ) {
|
636 |
if ( isset( $field['visible'] ) && $field['visible'] == 0 && isset($field['custom_field']) && $field['custom_field'] == 1 ){
|
637 |
+
if($value = wpdesk_get_order_meta( $order_id, '_'.$field['name'] , true )){
|
638 |
if ( !empty( $checkout_field_type[$field['type']]['has_options'] ) ) {
|
639 |
$array_options = explode("\n", $field['option']);
|
640 |
if(!empty($array_options)){
|
708 |
}
|
709 |
|
710 |
public function addCustomFieldsToEmail($order) {
|
711 |
+
$this -> addCustomFieldsToReview( wpdesk_get_order_id( $order ) );
|
712 |
}
|
713 |
|
714 |
public function addCustomFieldsBillingFields($fields) {
|
inc/wpdesk-woo27-functions.php
ADDED
@@ -0,0 +1,377 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( !function_exists( 'wpdesk_get_order_id' ) ) {
|
4 |
+
function wpdesk_get_order_id( $order ) {
|
5 |
+
if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
|
6 |
+
return $order->id;
|
7 |
+
} else {
|
8 |
+
return $order->get_id();
|
9 |
+
}
|
10 |
+
}
|
11 |
+
}
|
12 |
+
|
13 |
+
|
14 |
+
if ( !function_exists( 'wpdesk_get_order_item_meta_data' ) ) {
|
15 |
+
function wpdesk_get_order_item_meta_data( WC_Order $order, $item_id, $convert_to_array = false ) {
|
16 |
+
if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
|
17 |
+
return $order->has_meta( $item_id );
|
18 |
+
}
|
19 |
+
else {
|
20 |
+
if ( $convert_to_array ) {
|
21 |
+
$metas = $order->get_item( $item_id )->get_meta_data();
|
22 |
+
$ret = array();
|
23 |
+
foreach ( $metas as $meta ) {
|
24 |
+
$ret[] = array( 'id' => $meta->id, 'meta_id' => $meta->id, 'meta_key' => $meta->key, 'meta_value' => $meta->value );
|
25 |
+
}
|
26 |
+
return $ret;
|
27 |
+
}
|
28 |
+
else {
|
29 |
+
return $order->get_item( $item_id )->get_meta_data();
|
30 |
+
}
|
31 |
+
}
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
if ( !function_exists( 'wpdesk_get_order_meta' ) ) {
|
36 |
+
function wpdesk_get_order_meta( $order, $meta_key, $single = false ) {
|
37 |
+
if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
|
38 |
+
$load_order = false;
|
39 |
+
if ( in_array( $meta_key, array( 'order_date', 'customer_note' ) ) ) {
|
40 |
+
$load_order = true;
|
41 |
+
}
|
42 |
+
if ( is_numeric( $order ) && ! $load_order ) {
|
43 |
+
if ( $meta_key == '_currency' ) {
|
44 |
+
$meta_key = '_order_currency';
|
45 |
+
}
|
46 |
+
return get_post_meta( $order, $meta_key, $single );
|
47 |
+
} else {
|
48 |
+
switch ( $meta_key ) {
|
49 |
+
case 'order_date':
|
50 |
+
return $order->order_date;
|
51 |
+
case 'customer_note':
|
52 |
+
return $order->customer_note;
|
53 |
+
default:
|
54 |
+
return get_post_meta( $order->id, $meta_key, $single );
|
55 |
+
}
|
56 |
+
}
|
57 |
+
} else {
|
58 |
+
if ( is_numeric( $order ) ) {
|
59 |
+
$order = wc_get_order( $order );
|
60 |
+
}
|
61 |
+
|
62 |
+
switch ( $meta_key ) {
|
63 |
+
case '_parent_id':
|
64 |
+
return $order->get_parent_id();
|
65 |
+
break;
|
66 |
+
case '_status':
|
67 |
+
return $order->get_status();
|
68 |
+
break;
|
69 |
+
case '_order_currency':
|
70 |
+
case '_currency':
|
71 |
+
return $order->get_currency();
|
72 |
+
break;
|
73 |
+
case '_version':
|
74 |
+
return $order->get_version();
|
75 |
+
break;
|
76 |
+
case '_prices_include_tax':
|
77 |
+
return $order->get_prices_include_tax();
|
78 |
+
break;
|
79 |
+
case '_date_created':
|
80 |
+
return date( "Y-m-d H:i:s", get_date_created()->getTimestamp() );
|
81 |
+
break;
|
82 |
+
case '_date_modified':
|
83 |
+
return date( "Y-m-d H:i:s", $order->get_date_modified()->getTimestamp() );
|
84 |
+
break;
|
85 |
+
case '_discount_total':
|
86 |
+
return $order->get_discount_total();
|
87 |
+
break;
|
88 |
+
case '_discount_tax':
|
89 |
+
return $order->get_discount_tax();
|
90 |
+
break;
|
91 |
+
case '_shipping_total':
|
92 |
+
return $order->get_shipping_total();
|
93 |
+
break;
|
94 |
+
case '_shipping_tax':
|
95 |
+
return $order->get_shipping_tax();
|
96 |
+
break;
|
97 |
+
case '_cart_tax':
|
98 |
+
return $order->get_cart_tax();
|
99 |
+
break;
|
100 |
+
case '_total':
|
101 |
+
return $order->get_total();
|
102 |
+
break;
|
103 |
+
case '_total_tax':
|
104 |
+
return $order->get_total_tax();
|
105 |
+
break;
|
106 |
+
case '_customer_id':
|
107 |
+
return $order->get_customer_id();
|
108 |
+
break;
|
109 |
+
case '_order_key':
|
110 |
+
return $order->get_order_key();
|
111 |
+
break;
|
112 |
+
case '_billing_first_name':
|
113 |
+
return $order->get_billing_first_name();
|
114 |
+
break;
|
115 |
+
case '_billing_last_name':
|
116 |
+
return $order->get_billing_last_name();
|
117 |
+
break;
|
118 |
+
case '_billing_company':
|
119 |
+
return $order->get_billing_company();
|
120 |
+
break;
|
121 |
+
case '_billing_address_1':
|
122 |
+
return $order->get_billing_address_1();
|
123 |
+
break;
|
124 |
+
case '_billing_address_2':
|
125 |
+
return $order->get_billing_address_2();
|
126 |
+
break;
|
127 |
+
case '_billing_city':
|
128 |
+
return $order->get_billing_city();
|
129 |
+
break;
|
130 |
+
case '_billing_state':
|
131 |
+
return $order->get_billing_state();
|
132 |
+
break;
|
133 |
+
case '_billing_postcode':
|
134 |
+
return $order->get_billing_postcode();
|
135 |
+
break;
|
136 |
+
case '_billing_country':
|
137 |
+
return $order->get_billing_country();
|
138 |
+
break;
|
139 |
+
case '_billing_email':
|
140 |
+
return $order->get_billing_email();
|
141 |
+
break;
|
142 |
+
case '_billing_phone':
|
143 |
+
return $order->get_billing_phone();
|
144 |
+
break;
|
145 |
+
|
146 |
+
case '_shipping_first_name':
|
147 |
+
return $order->get_shipping_first_name();
|
148 |
+
break;
|
149 |
+
case '_shipping_last_name':
|
150 |
+
return $order->get_shipping_last_name();
|
151 |
+
break;
|
152 |
+
case '_shipping_company':
|
153 |
+
return $order->get_shipping_company();
|
154 |
+
break;
|
155 |
+
case '_shipping_address_1':
|
156 |
+
return $order->get_shipping_address_1();
|
157 |
+
break;
|
158 |
+
case '_shipping_address_2':
|
159 |
+
return $order->get_shipping_address_2();
|
160 |
+
break;
|
161 |
+
case '_shipping_city':
|
162 |
+
return $order->get_shipping_city();
|
163 |
+
break;
|
164 |
+
case '_shipping_state':
|
165 |
+
return $order->get_shipping_state();
|
166 |
+
break;
|
167 |
+
case '_shipping_postcode':
|
168 |
+
return $order->get_shipping_postcode();
|
169 |
+
break;
|
170 |
+
case '_shipping_country':
|
171 |
+
return $order->get_shipping_country();
|
172 |
+
break;
|
173 |
+
|
174 |
+
case '_payment_method':
|
175 |
+
return $order->get_payment_method();
|
176 |
+
break;
|
177 |
+
case '_payment_method_title':
|
178 |
+
return $order->get_payment_method_title();
|
179 |
+
break;
|
180 |
+
case '_transaction_id':
|
181 |
+
return $order->get_transaction_id();
|
182 |
+
break;
|
183 |
+
case '_customer_ip_address':
|
184 |
+
return $order->get_customer_ip_address();
|
185 |
+
break;
|
186 |
+
case '_customer_user_agent':
|
187 |
+
return $order->get_customer_user_agent();
|
188 |
+
break;
|
189 |
+
case '_created_via':
|
190 |
+
return $order->get_created_via();
|
191 |
+
break;
|
192 |
+
case '_customer_note':
|
193 |
+
return $order->get_customer_note();
|
194 |
+
break;
|
195 |
+
case '_completed_date':
|
196 |
+
case '_date_completed':
|
197 |
+
$date_completed = $order->get_date_completed();
|
198 |
+
if ( isset( $date_completed ) ) {
|
199 |
+
return date( "Y-m-d H:i:s", $date_completed->getTimestamp() );
|
200 |
+
}
|
201 |
+
return null;
|
202 |
+
break;
|
203 |
+
case '_date_paid':
|
204 |
+
return $order->get_date_paid();
|
205 |
+
break;
|
206 |
+
case '_cart_hash':
|
207 |
+
return $order->get_cart_hash();
|
208 |
+
break;
|
209 |
+
|
210 |
+
case 'order_date':
|
211 |
+
return date( "Y-m-d H:i:s", $order->get_date_created()->getTimestamp() );
|
212 |
+
break;
|
213 |
+
|
214 |
+
default:
|
215 |
+
$ret = $order->get_meta( $meta_key, $single );
|
216 |
+
return $ret;
|
217 |
+
}
|
218 |
+
}
|
219 |
+
}
|
220 |
+
}
|
221 |
+
|
222 |
+
if ( !function_exists( 'wpdesk_update_order_meta' ) ) {
|
223 |
+
function wpdesk_update_order_meta( $order, $meta_key, $meta_value ) {
|
224 |
+
if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
|
225 |
+
if ( is_numeric( $order ) ) {
|
226 |
+
$order_id = $order;
|
227 |
+
}
|
228 |
+
else {
|
229 |
+
$order_id = $order->id;
|
230 |
+
}
|
231 |
+
update_post_meta( $order_id, $meta_key, $meta_value );
|
232 |
+
}
|
233 |
+
else {
|
234 |
+
if ( is_numeric( $order ) ) {
|
235 |
+
$order_id = $order;
|
236 |
+
$order = wc_get_order( $order_id );
|
237 |
+
}
|
238 |
+
$order->update_meta_data( $meta_key, $meta_value );
|
239 |
+
$order->save();
|
240 |
+
}
|
241 |
+
}
|
242 |
+
}
|
243 |
+
|
244 |
+
|
245 |
+
if ( !function_exists( 'wpdesk_get_product_id' ) ) {
|
246 |
+
function wpdesk_get_product_id( WC_Product $product ) {
|
247 |
+
if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
|
248 |
+
return $product->id;
|
249 |
+
} else {
|
250 |
+
return $product->get_id();
|
251 |
+
}
|
252 |
+
}
|
253 |
+
}
|
254 |
+
|
255 |
+
if ( !function_exists( 'wpdesk_get_product_variation_id' ) ) {
|
256 |
+
function wpdesk_get_product_variation_id( WC_Product_Variation $product ) {
|
257 |
+
if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
|
258 |
+
return $product->variation_id;
|
259 |
+
} else {
|
260 |
+
return $product->get_id();
|
261 |
+
}
|
262 |
+
}
|
263 |
+
}
|
264 |
+
|
265 |
+
if ( !function_exists( 'wpdesk_get_variation_id' ) ) {
|
266 |
+
function wpdesk_get_variation_id( WC_Product_Variation $product ) {
|
267 |
+
if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
|
268 |
+
return $product->variation_id;
|
269 |
+
} else {
|
270 |
+
return $product->get_id();
|
271 |
+
}
|
272 |
+
}
|
273 |
+
}
|
274 |
+
|
275 |
+
if ( !function_exists( 'wpdesk_get_variation_parent_id' ) ) {
|
276 |
+
function wpdesk_get_variation_parent_id( WC_Product_Variation $product ) {
|
277 |
+
if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
|
278 |
+
return $product->id;
|
279 |
+
} else {
|
280 |
+
return $product->get_parent_id();
|
281 |
+
}
|
282 |
+
}
|
283 |
+
}
|
284 |
+
|
285 |
+
if ( !function_exists( 'wpdesk_get_price_including_tax' ) ) {
|
286 |
+
function wpdesk_get_price_including_tax( WC_Product $product, $qty = 1, $price = '' ) {
|
287 |
+
if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
|
288 |
+
return $product->get_price_including_tax( $qty, $price );
|
289 |
+
}
|
290 |
+
else {
|
291 |
+
$args = array( 'qty' => $qty, 'price' => $price );
|
292 |
+
return wc_get_price_including_tax( $product, $args );
|
293 |
+
}
|
294 |
+
}
|
295 |
+
}
|
296 |
+
|
297 |
+
if ( !function_exists( 'wpdesk_get_price_excluding_tax' ) ) {
|
298 |
+
function wpdesk_get_price_excluding_tax( WC_Product $product, $qty = 1, $price = '' ) {
|
299 |
+
if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
|
300 |
+
return $product->get_price_excluding_tax( $qty, $price );
|
301 |
+
}
|
302 |
+
else {
|
303 |
+
$args = array( 'qty' => $qty, 'price' => $price );
|
304 |
+
return wc_get_price_excluding_tax( $product, $args );
|
305 |
+
}
|
306 |
+
}
|
307 |
+
}
|
308 |
+
|
309 |
+
if ( !function_exists( 'wpdesk_reduce_stock_levels' ) ) {
|
310 |
+
function wpdesk_reduce_stock_levels( WC_Order $order ) {
|
311 |
+
if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
|
312 |
+
return $order->reduce_order_stock();
|
313 |
+
} else {
|
314 |
+
wc_reduce_stock_levels( $order->get_id() );
|
315 |
+
}
|
316 |
+
}
|
317 |
+
}
|
318 |
+
|
319 |
+
|
320 |
+
if ( !function_exists( 'wpdesk_get_product_meta' ) ) {
|
321 |
+
function wpdesk_get_product_meta( $product, $meta_key, $single = false ) {
|
322 |
+
if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
|
323 |
+
if ( is_numeric( $product ) ) {
|
324 |
+
return get_post_meta( $product, $meta_key, $single );
|
325 |
+
} else {
|
326 |
+
return get_post_meta( $product->id, $meta_key, $single );
|
327 |
+
}
|
328 |
+
} else {
|
329 |
+
if ( is_numeric( $product ) ) {
|
330 |
+
$product = wc_get_product( $product );
|
331 |
+
}
|
332 |
+
switch ( $meta_key ) {
|
333 |
+
case '_stock_status' :
|
334 |
+
return $product->get_stock_status();
|
335 |
+
default:
|
336 |
+
break;
|
337 |
+
}
|
338 |
+
return $product->get_meta( $meta_key, $single );
|
339 |
+
}
|
340 |
+
}
|
341 |
+
}
|
342 |
+
|
343 |
+
|
344 |
+
if ( !function_exists( 'wpdesk_update_product_meta' ) ) {
|
345 |
+
function wpdesk_update_product_meta( $product, $meta_key, $meta_value ) {
|
346 |
+
$product_id = false;
|
347 |
+
if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
|
348 |
+
if ( is_numeric( $product ) ) {
|
349 |
+
$product_id = $product;
|
350 |
+
}
|
351 |
+
else {
|
352 |
+
$product_id = $product->id;
|
353 |
+
}
|
354 |
+
update_post_meta( $product_id, $meta_key, $meta_value );
|
355 |
+
}
|
356 |
+
else {
|
357 |
+
if ( is_numeric( $product ) ) {
|
358 |
+
$product_id = $product;
|
359 |
+
$product = wc_get_product( $product_id );
|
360 |
+
}
|
361 |
+
$product->update_meta_data( $meta_key, $meta_value );
|
362 |
+
$product->save();
|
363 |
+
}
|
364 |
+
}
|
365 |
+
}
|
366 |
+
|
367 |
+
if ( !function_exists( 'wpdesk_get_product_post' ) ) {
|
368 |
+
function wpdesk_get_product_post( WC_Product $product ) {
|
369 |
+
if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
|
370 |
+
return $product->get_post_data();
|
371 |
+
}
|
372 |
+
else {
|
373 |
+
return get_post( $product->get_id() );
|
374 |
+
}
|
375 |
+
}
|
376 |
+
}
|
377 |
+
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: wpdesk, swoboda, jablonowski
|
3 |
Donate link: https://www.wpdesk.net/flexible-checkout-fields-woocommerce/
|
4 |
Tags: woocommerce checkout, woocommerce checkout fields, flexible checkout fields, woocommerce checkout manager, woocommerce checkout editor, woocommerce fields manager, woocommerce fields editor, woocommerce custom checkout fields, woocommerce checkout options, woocommerce checkout pro, woocommerce custom sections, woocommerce file upload
|
5 |
-
Requires at least: 4.
|
6 |
-
Tested up to: 4.7.
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -146,6 +146,10 @@ If you are upgrading from the old WooCommerce Checkout Fields version (1.1, wooc
|
|
146 |
|
147 |
== Changelog ==
|
148 |
|
|
|
|
|
|
|
|
|
149 |
= 1.4 - 2017-02-15 =
|
150 |
* Added support for conditional logic in FCF PRO 1.4 (this update is necessary for FCF PRO 1.4)
|
151 |
* Disabled editing field name for: Town, State, Postcode (unsupported in WooCommerce)
|
2 |
Contributors: wpdesk, swoboda, jablonowski
|
3 |
Donate link: https://www.wpdesk.net/flexible-checkout-fields-woocommerce/
|
4 |
Tags: woocommerce checkout, woocommerce checkout fields, flexible checkout fields, woocommerce checkout manager, woocommerce checkout editor, woocommerce fields manager, woocommerce fields editor, woocommerce custom checkout fields, woocommerce checkout options, woocommerce checkout pro, woocommerce custom sections, woocommerce file upload
|
5 |
+
Requires at least: 4.4
|
6 |
+
Tested up to: 4.7.3
|
7 |
+
Stable tag: 1.5
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
146 |
|
147 |
== Changelog ==
|
148 |
|
149 |
+
= 1.5 - 2017-04-03 =
|
150 |
+
* Added support for upcoming WooCommerce 3.0
|
151 |
+
* Dropped support for WooCommerce below 2.5 (the plugin may still work with older versions but we do not declare official support)
|
152 |
+
|
153 |
= 1.4 - 2017-02-15 =
|
154 |
* Added support for conditional logic in FCF PRO 1.4 (this update is necessary for FCF PRO 1.4)
|
155 |
* Disabled editing field name for: Town, State, Postcode (unsupported in WooCommerce)
|