Version Description
- Fix: woocommerce checkout conditional fields
Download this release
Release Info
Developer | quadlayers |
Plugin | WooCommerce Checkout Manager |
Version | 5.0.0 |
Comparing to | |
See all releases |
Code changes from version 4.9.9 to 5.0.0
- assets/backend/css/wooccm-admin.css +8 -7
- assets/backend/css/wooccm-admin.css.map +1 -1
- assets/backend/css/wooccm-admin.min.css +1 -1
- includes/class-wooccm-compatibility.php +10 -7
- includes/class-wooccm-notices.php +25 -3
- includes/view/backend/pages/modals/parts/info.php +1 -1
- includes/view/backend/pages/modals/parts/panel-datepicker.php +1 -1
- includes/view/backend/pages/modals/parts/panel-options.php +2 -2
- includes/view/frontend/class-wooccm-fields-handler.php +253 -253
- readme.txt +5 -2
- woocommerce-checkout-manager.php +2 -2
assets/backend/css/wooccm-admin.css
CHANGED
@@ -77,6 +77,9 @@ table.wooccm-enhanced-options > tbody > tr > td.sort .wc-item-reorder-nav {
|
|
77 |
#wooccm_modal select {
|
78 |
min-height: 30px;
|
79 |
}
|
|
|
|
|
|
|
80 |
#wooccm_modal .attachment-info .details,
|
81 |
#wooccm_modal .attachment-info .settings {
|
82 |
width: 100%;
|
@@ -117,17 +120,15 @@ table.wooccm-enhanced-options > tbody > tr > td.sort .wc-item-reorder-nav {
|
|
117 |
#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container {
|
118 |
width: 50%!important;
|
119 |
line-height: 16px;
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
}*/
|
126 |
}
|
127 |
#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container .select2-selection--multiple {
|
128 |
line-height: 16px;
|
129 |
min-height: 30px;
|
130 |
-
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.07);
|
131 |
}
|
132 |
@media only screen and (max-width: 1280px) {
|
133 |
#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container {
|
77 |
#wooccm_modal select {
|
78 |
min-height: 30px;
|
79 |
}
|
80 |
+
#wooccm_modal .form-field .wrap {
|
81 |
+
padding: 0;
|
82 |
+
}
|
83 |
#wooccm_modal .attachment-info .details,
|
84 |
#wooccm_modal .attachment-info .settings {
|
85 |
width: 100%;
|
120 |
#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container {
|
121 |
width: 50%!important;
|
122 |
line-height: 16px;
|
123 |
+
}
|
124 |
+
#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container .select2-selection {
|
125 |
+
box-shadow: none;
|
126 |
+
border-radius: 3px;
|
127 |
+
padding: 0 24px 0 8px;
|
|
|
128 |
}
|
129 |
#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container .select2-selection--multiple {
|
130 |
line-height: 16px;
|
131 |
min-height: 30px;
|
|
|
132 |
}
|
133 |
@media only screen and (max-width: 1280px) {
|
134 |
#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container {
|
assets/backend/css/wooccm-admin.css.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["../../less/wooccm-admin.less"],"names":[],"mappings":"AAAA;EACE,gBAAA;;AADF,kBAGE;AAHF,kBAIE,2BAA2B;AAJ7B,kBAKE,2BAA2B;EACzB,sBAAA;EACA,2BAAA;;AAIJ;EACE,YAAA;EACA,oBAAA;;;;;;;;;;;AAeA,OAAC;EACC,kBAAA;EACA,0BAAA;;AAFF,OAAC,iBAIC;EACE,kBAAA;EACA,MAAA;EACA,QAAA;EACA,SAAA;EACA,UAAA;EACA,YAAW,kBAAX;EACA,gBAAA;EACA,cAAA;EACA,eAAA;;AAOJ,KAAC,YAEC,QAEE,KACE,KAEE;EACE,wBAAA;;AAGF,KAXP,YAEC,QAEE,KACE,KAMG;EACC,gBAAA;;AAQV,KAAC;EACC,YAAA;EACA,gBAAA;;AAFF,KAAC,wBAIC,QACE,KACE;EACE,uBAAA;;AAPR,KAAC,wBAYC,QACE,KACE,KACE,MAAK;EACH,WAAA;;AAhBV,KAAC,wBAYC,QACE,KACE,KAIE,OAAM;EACJ,kBAAA;;AAnBV,KAAC,wBAYC,QACE,KACE,KAOE,MAAK;EACH,aAAA;;AAGF,KAzBP,wBAYC,QACE,KACE,KAWG,KAAM;EACL,WAAA;;AAUV,aAAC;EACC,oBAAA;;AACA,aAFD,WAEE;EACC,SAAS,EAAT;EACA,kBAAA;EACA,MAAA;EAAO,SAAA;EAAW,OAAA;EAAS,QAAA;EAC3B,yBAAA;EACA,iBAAA;EACA,YAAA;;AAVN,aAcE;EACE,gBAAA;;AAfJ,aAkBE,iBACE;
|
1 |
+
{"version":3,"sources":["../../less/wooccm-admin.less"],"names":[],"mappings":"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","file":"wooccm-admin.css"}
|
assets/backend/css/wooccm-admin.min.css
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
|
2 |
-
.select2-container{z-index:9999999}.wooccm-premium{opacity:.5;pointer-events:none}.button.fileinput-button{position:relative;overflow:hidden!important}.button.fileinput-button input{position:absolute;top:0;right:0;margin:0;opacity:0;-ms-filter:'alpha(opacity=0)';font-size:200px;direction:ltr;cursor:pointer}table.wc_gateways>tbody>tr>td.label{font-weight:600}table.wooccm-enhanced-options{border:0;box-shadow:none}table.wooccm-enhanced-options>thead>th .woocommerce-help-tip{margin:-1px 0 0 .25em}table.wooccm-enhanced-options>tbody>tr>td input.label{width:100%}table.wooccm-enhanced-options>tbody>tr>td select.add-price-type{margin:0 0 0 10px}table.wooccm-enhanced-options>tbody>tr>td input.check{margin:0 9px}table.wooccm-enhanced-options>tbody>tr>td.sort .wc-item-reorder-nav{width:auto}.attachment-info .details
|
1 |
|
2 |
+
.select2-container{z-index:9999999}.select2-container .select2-selection--single,.select2-container .select2-selection--single .select2-selection__rendered,.select2-container .select2-selection--single .select2-selection__arrow{height:30px!important;line-height:30px!important}.wooccm-premium{opacity:.5;pointer-events:none}.button.fileinput-button{position:relative;overflow:hidden!important}.button.fileinput-button input{position:absolute;top:0;right:0;margin:0;opacity:0;-ms-filter:'alpha(opacity=0)';font-size:200px;direction:ltr;cursor:pointer}table.wc_gateways>tbody>tr>td select{line-height:1!important}table.wc_gateways>tbody>tr>td.label{font-weight:600}table.wooccm-enhanced-options{border:0;box-shadow:none}table.wooccm-enhanced-options>thead>th .woocommerce-help-tip{margin:-1px 0 0 .25em}table.wooccm-enhanced-options>tbody>tr>td input.label{width:100%}table.wooccm-enhanced-options>tbody>tr>td select.add-price-type{margin:0 0 0 10px}table.wooccm-enhanced-options>tbody>tr>td input.check{margin:0 9px}table.wooccm-enhanced-options>tbody>tr>td.sort .wc-item-reorder-nav{width:auto}#wooccm_modal.processing{pointer-events:none}#wooccm_modal.processing:before{content:'';position:absolute;top:0;bottom:0;left:0;right:0;background-color:#fff;z-index:99999999;opacity:.8}#wooccm_modal select{min-height:30px}#wooccm_modal .form-field .wrap{padding:0}#wooccm_modal .attachment-info .details,#wooccm_modal .attachment-info .settings{width:100%}#wooccm_modal .attachment-info .woocommerce_options_panel label,#wooccm_modal .attachment-info .woocommerce_options_panel legend{width:75px;margin:0 0 0 -90px;font-weight:600}#wooccm_modal .attachment-info .woocommerce_options_panel fieldset.form-field,#wooccm_modal .attachment-info .woocommerce_options_panel p.form-field{padding:0 20px 0 92px!important}#wooccm_modal .attachment-info .woocommerce_options_panel input[type=email],#wooccm_modal .attachment-info .woocommerce_options_panel input[type=number],#wooccm_modal .attachment-info .woocommerce_options_panel input[type=password],#wooccm_modal .attachment-info .woocommerce_options_panel input[type=text],#wooccm_modal .attachment-info .woocommerce_options_panel select,#wooccm_modal .attachment-info .woocommerce_options_panel .select2-container{width:100%!important}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel{width:100%}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .premium{display:block;clear:both}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .woocommerce-help-tip{margin:0 0 0 .5em}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container{width:50%!important;line-height:16px}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container .select2-selection{box-shadow:none;border-radius:3px;padding:0 24px 0 8px}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container .select2-selection--multiple{line-height:16px;min-height:30px}@media only screen and (max-width:1280px){#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container{width:80%!important}}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container--default .select2-selection--multiple .select2-selection__rendered li{margin:3px 3px 0 0}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container--default.select2-container--focus .select2-selection--multiple{border-color:#5b9dd9!important;box-shadow:0 0 2px rgba(30,140,190,0.8)!important;outline:2px solid transparent!important}#wooccm-order-files .inside{margin:0;padding:0;background:#fefefe;display:block!important}#wooccm-order-files .handlediv,#wooccm-order-files .hndle{display:none}#wooccm-order-files .wooccm_upload_results{display:inline-block;margin:0 10px}#wooccm-order-files .wooccm_order_attachments_wrapper{margin:0;overflow-x:auto}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments{width:100%;background:#fff}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th:first-child{padding-left:2em}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th.sortable{cursor:pointer}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments .item{min-width:200px}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th{text-align:left;padding:1em;font-weight:400;color:#999;background:#f8f8f8;user-select:none}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody#order_line_items tr:first-child td{border-top:0}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody tr:last-child td{border-bottom:1px solid #dfdfdf}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td.thumb{text-align:left;width:38px;padding-bottom:1.5em}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td.thumb .wc-order-item-thumbnail{width:38px;height:38px;border:2px solid #e8e8e8;background:#f8f8f8;color:#ccc;position:relative;font-size:21px;display:block;text-align:center}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody th:first-child,#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td:first-child{padding-left:2em}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody th,#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td{padding:1.5em 1em 1em;text-align:left;line-height:1.5em;vertical-align:top;border-bottom:1px solid #f8f8f8}#wooccm-order-files .wc-order-data-row{border-bottom:1px solid #dfdfdf;padding:1.5em 2em;background:#f8f8f8;line-height:2em;text-align:left}
|
includes/class-wooccm-compatibility.php
CHANGED
@@ -272,7 +272,7 @@ class WOOCCM_Field_Compatibility {
|
|
272 |
if (is_array($options)) {
|
273 |
|
274 |
$field['options'] = array();
|
275 |
-
$i = 0;
|
276 |
foreach ($options as $key => $label) {
|
277 |
$field['options'][] = array(
|
278 |
'label' => $label,
|
@@ -283,21 +283,24 @@ class WOOCCM_Field_Compatibility {
|
|
283 |
);
|
284 |
|
285 |
if (!empty($field['conditional_parent_value']) && $field['conditional_parent_value'] == $label) {
|
286 |
-
$field['conditional_parent_value'] = $
|
287 |
}
|
288 |
|
289 |
-
$i++;
|
290 |
}
|
291 |
}
|
292 |
}
|
293 |
}
|
294 |
|
295 |
-
if (!empty($field['conditional_parent_key']) &&
|
296 |
-
// if ($parent_id = @max(array_keys(array_column($fields, 'key'), $field['conditional_parent_key']))) {
|
297 |
if ($parent_id = WOOCCM()->$prefix->get_field_id($fields, 'key', $field['conditional_parent_key'])) {
|
298 |
if (isset($fields[$parent_id]) && !empty($fields[$parent_id]['options'])) {
|
299 |
-
$
|
300 |
-
|
|
|
|
|
|
|
|
|
301 |
}
|
302 |
}
|
303 |
}
|
272 |
if (is_array($options)) {
|
273 |
|
274 |
$field['options'] = array();
|
275 |
+
// $i = 0;
|
276 |
foreach ($options as $key => $label) {
|
277 |
$field['options'][] = array(
|
278 |
'label' => $label,
|
283 |
);
|
284 |
|
285 |
if (!empty($field['conditional_parent_value']) && $field['conditional_parent_value'] == $label) {
|
286 |
+
$field['conditional_parent_value'] = $label;
|
287 |
}
|
288 |
|
289 |
+
// $i++;
|
290 |
}
|
291 |
}
|
292 |
}
|
293 |
}
|
294 |
|
295 |
+
if (!empty($field['conditional_parent_key']) && isset($field['conditional_parent_value'])) {
|
|
|
296 |
if ($parent_id = WOOCCM()->$prefix->get_field_id($fields, 'key', $field['conditional_parent_key'])) {
|
297 |
if (isset($fields[$parent_id]) && !empty($fields[$parent_id]['options'])) {
|
298 |
+
$labels = array_column($fields[$parent_id]['options'], 'label');
|
299 |
+
|
300 |
+
if (isset($labels[$field['conditional_parent_value']])) {
|
301 |
+
|
302 |
+
$field['conditional_parent_value'] = $labels[$field['conditional_parent_value']];
|
303 |
+
}
|
304 |
}
|
305 |
}
|
306 |
}
|
includes/class-wooccm-notices.php
CHANGED
@@ -39,7 +39,7 @@ class WOOCCM_Notices {
|
|
39 |
|
40 |
if (!get_user_meta(get_current_user_id(), 'wooccm-beta-notice', true) && get_option('wccs_settings')) {
|
41 |
?>
|
42 |
-
<div
|
43 |
<div class="notice-container" style="padding-top: 10px; padding-bottom: 10px; display: flex; justify-content: left; align-items: center;">
|
44 |
<div class="notice-image">
|
45 |
<img style="border-radius:50%;max-width: 90px;" src="<?php echo plugins_url('/assets/backend/img/logo.jpg', WOOCCM_PLUGIN_FILE); ?>" alt="<?php echo esc_html(WOOCCM_PLUGIN_NAME); ?>>">
|
@@ -83,7 +83,7 @@ class WOOCCM_Notices {
|
|
83 |
<?php
|
84 |
} elseif (!get_user_meta(get_current_user_id(), 'wooccm-user-rating', true) && !get_transient('wooccm-first-rating') && !get_option('wccs_settings')) {
|
85 |
?>
|
86 |
-
<div
|
87 |
<div class="notice-container" style="padding-top: 10px; padding-bottom: 10px; display: flex; justify-content: left; align-items: center;">
|
88 |
<div class="notice-image">
|
89 |
<img style="border-radius:50%;max-width: 90px;" src="<?php echo plugins_url('/assets/backend/img/logo.jpg', WOOCCM_PLUGIN_FILE); ?>" alt="<?php echo esc_html(WOOCCM_PLUGIN_NAME); ?>>">
|
@@ -106,7 +106,29 @@ class WOOCCM_Notices {
|
|
106 |
</div>
|
107 |
</div>
|
108 |
</div>
|
109 |
-
<?php }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
?>
|
111 |
<script>
|
112 |
(function ($) {
|
39 |
|
40 |
if (!get_user_meta(get_current_user_id(), 'wooccm-beta-notice', true) && get_option('wccs_settings')) {
|
41 |
?>
|
42 |
+
<div class="wooccm-notice notice is-dismissible" data-notice_id="wooccm-beta-notice">
|
43 |
<div class="notice-container" style="padding-top: 10px; padding-bottom: 10px; display: flex; justify-content: left; align-items: center;">
|
44 |
<div class="notice-image">
|
45 |
<img style="border-radius:50%;max-width: 90px;" src="<?php echo plugins_url('/assets/backend/img/logo.jpg', WOOCCM_PLUGIN_FILE); ?>" alt="<?php echo esc_html(WOOCCM_PLUGIN_NAME); ?>>">
|
83 |
<?php
|
84 |
} elseif (!get_user_meta(get_current_user_id(), 'wooccm-user-rating', true) && !get_transient('wooccm-first-rating') && !get_option('wccs_settings')) {
|
85 |
?>
|
86 |
+
<div class="wooccm-notice notice is-dismissible" data-notice_id="wooccm-user-rating">
|
87 |
<div class="notice-container" style="padding-top: 10px; padding-bottom: 10px; display: flex; justify-content: left; align-items: center;">
|
88 |
<div class="notice-image">
|
89 |
<img style="border-radius:50%;max-width: 90px;" src="<?php echo plugins_url('/assets/backend/img/logo.jpg', WOOCCM_PLUGIN_FILE); ?>" alt="<?php echo esc_html(WOOCCM_PLUGIN_NAME); ?>>">
|
106 |
</div>
|
107 |
</div>
|
108 |
</div>
|
109 |
+
<?php } elseif (!get_user_meta(get_current_user_id(), 'wooccm-update-5', true)) { ?>
|
110 |
+
<div id="wooccm-update-5" class="wooccm-notice notice is-dismissible" data-notice_id="wooccm-update-5">
|
111 |
+
<div class="notice-container" style="padding-top: 10px; padding-bottom: 10px; display: flex; justify-content: left; align-items: center;">
|
112 |
+
<div class="notice-image">
|
113 |
+
<img style="border-radius:50%;max-width: 90px;" src="<?php echo plugins_url('/assets/backend/img/logo.jpg', WOOCCM_PLUGIN_FILE); ?>" alt="<?php echo esc_html(WOOCCM_PLUGIN_NAME); ?>>">
|
114 |
+
</div>
|
115 |
+
<div class="notice-content" style="margin-left: 15px;">
|
116 |
+
<p>
|
117 |
+
<b><?php printf(esc_html__('Important! Manual update is required.', 'woocommerce-checkout-manager'), WOOCCM_PLUGIN_NAME); ?></b>
|
118 |
+
<br/>
|
119 |
+
<?php esc_html_e('Due to the recent WooCommerce 4.0 changes it is necessary to reconfigure conditional fields. If you have conditional fields, please go to the billing, shipping and advanced sections and set conditionals relationships again.', 'woocommerce-checkout-manager'); ?>
|
120 |
+
</p>
|
121 |
+
<a href="<?php echo admin_url('admin.php?page=wc-settings&tab=wooccm'); ?>" class="button-primary" target="_blank">
|
122 |
+
<?php esc_html_e('Settings', 'woocommerce-checkout-manager'); ?>
|
123 |
+
</a>
|
124 |
+
<a href="<?php echo str_replace('/?utm_source=wooccm_admin', '/conditional/?utm_source=wooccm_admin', WOOCCM_DOCUMENTATION_URL); ?>" class="button-secondary" target="_blank">
|
125 |
+
<?php esc_html_e('Documentation', 'woocommerce-checkout-manager'); ?>
|
126 |
+
</a>
|
127 |
+
</div>
|
128 |
+
</div>
|
129 |
+
</div>
|
130 |
+
<?php
|
131 |
+
}
|
132 |
?>
|
133 |
<script>
|
134 |
(function ($) {
|
includes/view/backend/pages/modals/parts/info.php
CHANGED
@@ -45,7 +45,7 @@
|
|
45 |
<# if ( data.parent != undefined && _.contains(<?php echo json_encode($option); ?>, data.parent.type) && _.isObject(data.parent.options)) { #>
|
46 |
<select class="wooccm-enhanced-select" name="conditional_parent_value">
|
47 |
<# _.each(data.parent.options, function (option, index) { #>
|
48 |
-
<option <# if ( index == data.conditional_parent_value ) { #>selected="selected"<# } #> value="{{
|
49 |
<# }); #>
|
50 |
</select>
|
51 |
<# } else if( data.parent != undefined && data.parent.type == 'checkbox' ) { #>
|
45 |
<# if ( data.parent != undefined && _.contains(<?php echo json_encode($option); ?>, data.parent.type) && _.isObject(data.parent.options)) { #>
|
46 |
<select class="wooccm-enhanced-select" name="conditional_parent_value">
|
47 |
<# _.each(data.parent.options, function (option, index) { #>
|
48 |
+
<option <# if ( index == data.conditional_parent_value ) { #>selected="selected"<# } #> value="{{option.label}}">{{option.label}}</option>
|
49 |
<# }); #>
|
50 |
</select>
|
51 |
<# } else if( data.parent != undefined && data.parent.type == 'checkbox' ) { #>
|
includes/view/backend/pages/modals/parts/panel-datepicker.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
<p class="form-field">
|
13 |
<label><?php esc_html_e('Date format', 'woocommerce-checkout-manager'); ?></label>
|
14 |
<input <# if ( !data.select2 ) { #>disabled="disabled"<# } #> class="short" type="text" placeholder="dd-mm-yy" name="date_format" value="{{data.date_format}}">
|
15 |
-
<span class="description"><a href="https://
|
16 |
<span class="description premium">(<?php esc_html_e('This is a premium feature', 'woocommerce-checkout-manager'); ?>)</span>
|
17 |
</p>
|
18 |
</div>
|
12 |
<p class="form-field">
|
13 |
<label><?php esc_html_e('Date format', 'woocommerce-checkout-manager'); ?></label>
|
14 |
<input <# if ( !data.select2 ) { #>disabled="disabled"<# } #> class="short" type="text" placeholder="dd-mm-yy" name="date_format" value="{{data.date_format}}">
|
15 |
+
<span class="description"><a target="_blank" href="https://wordpress.org/support/article/formatting-date-and-time/">Documentation on date and time formatting</a>.</span>
|
16 |
<span class="description premium">(<?php esc_html_e('This is a premium feature', 'woocommerce-checkout-manager'); ?>)</span>
|
17 |
</p>
|
18 |
</div>
|
includes/view/backend/pages/modals/parts/panel-options.php
CHANGED
@@ -47,9 +47,9 @@
|
|
47 |
</td>
|
48 |
<td>
|
49 |
<# if ( _.contains(<?php echo json_encode($multiple); ?>, data.type)) { #>
|
50 |
-
<input value="{{
|
51 |
<# } else { #>
|
52 |
-
<input value="{{
|
53 |
<# } #>
|
54 |
</td>
|
55 |
<td class="sort ui-sortable-handle">
|
47 |
</td>
|
48 |
<td>
|
49 |
<# if ( _.contains(<?php echo json_encode($multiple); ?>, data.type)) { #>
|
50 |
+
<input value="{{option.label}}" type="checkbox" name="options[{{index}}][default]" <# if (option.default) { #>checked="checked"<# } #> />
|
51 |
<# } else { #>
|
52 |
+
<input value="{{option.label}}" type="radio" name="default" <# if (data.default == option.label) { #>checked="checked"<# } #> />
|
53 |
<# } #>
|
54 |
</td>
|
55 |
<td class="sort ui-sortable-handle">
|
includes/view/frontend/class-wooccm-fields-handler.php
CHANGED
@@ -1,253 +1,253 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WOOCCM_Fields_Handler {
|
4 |
-
|
5 |
-
protected static $_instance;
|
6 |
-
|
7 |
-
public function __construct() {
|
8 |
-
$this->init();
|
9 |
-
}
|
10 |
-
|
11 |
-
public static function instance() {
|
12 |
-
if (is_null(self::$_instance)) {
|
13 |
-
self::$_instance = new self();
|
14 |
-
}
|
15 |
-
return self::$_instance;
|
16 |
-
}
|
17 |
-
|
18 |
-
public function posted_data($data) {
|
19 |
-
|
20 |
-
if (count($fields = WC()->session->wooccm['fields'])) {
|
21 |
-
|
22 |
-
foreach ($fields as $key => $field) {
|
23 |
-
|
24 |
-
switch ($field['type']) {
|
25 |
-
|
26 |
-
case 'multicheckbox':
|
27 |
-
|
28 |
-
$data[$key] = isset($_POST[$key]) ? implode(', ', wc_clean(wp_unslash($_POST[$key]))) : '';
|
29 |
-
|
30 |
-
break;
|
31 |
-
|
32 |
-
case 'checkbox':
|
33 |
-
|
34 |
-
if (!empty($_POST[$key])) {
|
35 |
-
$data[$key] = __('Yes', 'woocommerce-checkout-manager');
|
36 |
-
} else {
|
37 |
-
$data[$key] = __('No', 'woocommerce-checkout-manager');
|
38 |
-
}
|
39 |
-
|
40 |
-
break;
|
41 |
-
}
|
42 |
-
}
|
43 |
-
}
|
44 |
-
|
45 |
-
return $data;
|
46 |
-
}
|
47 |
-
|
48 |
-
public function add_field_filter($field) {
|
49 |
-
|
50 |
-
if (isset(WC()->session)) {
|
51 |
-
$session_data = WC()->session->wooccm;
|
52 |
-
}
|
53 |
-
|
54 |
-
// keep attr id = attr name
|
55 |
-
// -------------------------------------------------------------------------
|
56 |
-
unset($field['id']);
|
57 |
-
|
58 |
-
switch ($field['type']) {
|
59 |
-
|
60 |
-
case 'select':
|
61 |
-
case 'radio':
|
62 |
-
|
63 |
-
if (!empty($field['options'])) {
|
64 |
-
if (is_array($field['options'])) {
|
65 |
-
$field['add_price_total'] = array_column($field['options'], 'add_price_total');
|
66 |
-
$field['add_price_type'] = array_column($field['options'], 'add_price_type');
|
67 |
-
$field['add_price_tax'] = array_column($field['options'], 'add_price_tax');
|
68 |
-
$field['options'] = array_column($field['options'], 'label');
|
69 |
-
}
|
70 |
-
} else {
|
71 |
-
$field['disabled'] = true;
|
72 |
-
}
|
73 |
-
|
74 |
-
break;
|
75 |
-
|
76 |
-
case 'multiselect':
|
77 |
-
case 'multicheckbox':
|
78 |
-
|
79 |
-
if (!empty($field['options'])) {
|
80 |
-
if (is_array($field['options'])) {
|
81 |
-
$field['add_price_total'] = array_column($field['options'], 'add_price_total');
|
82 |
-
$field['add_price_type'] = array_column($field['options'], 'add_price_type');
|
83 |
-
$field['add_price_tax'] = array_column($field['options'], 'add_price_tax');
|
84 |
-
$field['default'] = array_column($field['options'], 'default');
|
85 |
-
$field['options'] = array_column($field['options'], 'label');
|
86 |
-
}
|
87 |
-
} else {
|
88 |
-
$field['disabled'] = true;
|
89 |
-
}
|
90 |
-
|
91 |
-
break;
|
92 |
-
|
93 |
-
case 'heading':
|
94 |
-
$field['required'] = false;
|
95 |
-
break;
|
96 |
-
}
|
97 |
-
|
98 |
-
// Priority
|
99 |
-
// -----------------------------------------------------------------------
|
100 |
-
if (isset($field['order'])) {
|
101 |
-
$field['priority'] = $field['order'] * 10;
|
102 |
-
}
|
103 |
-
|
104 |
-
if (isset(WC()->session)) {
|
105 |
-
$session_data['fields'][$field['key']] = $field;
|
106 |
-
WC()->session->wooccm = $session_data;
|
107 |
-
}
|
108 |
-
|
109 |
-
return $field;
|
110 |
-
}
|
111 |
-
|
112 |
-
public function add_field_classes($field) {
|
113 |
-
|
114 |
-
// Position
|
115 |
-
// -----------------------------------------------------------------------
|
116 |
-
if (!empty($field['position'])) {
|
117 |
-
$field['class'] = array_diff($field['class'], array('form-row-wide', 'form-row-first', 'form-row-last'));
|
118 |
-
$field['class'][] = $field['position'];
|
119 |
-
}
|
120 |
-
|
121 |
-
// WOOCCM
|
122 |
-
// -----------------------------------------------------------------------
|
123 |
-
|
124 |
-
$field['class'][] = 'wooccm-field';
|
125 |
-
$field['class'][] = 'wooccm-field-' . $field['name'];
|
126 |
-
|
127 |
-
// Type
|
128 |
-
// -----------------------------------------------------------------------
|
129 |
-
if (!empty($field['type'])) {
|
130 |
-
$field['class'][] = 'wooccm-type-' . $field['type'];
|
131 |
-
}
|
132 |
-
|
133 |
-
// Color
|
134 |
-
// -----------------------------------------------------------------------
|
135 |
-
if (!empty($field['type']) && $field['type'] == 'colorpicker') {
|
136 |
-
$field['class'][] = 'wooccm-colorpicker-' . $field['pickertype'];
|
137 |
-
}
|
138 |
-
|
139 |
-
// Extra
|
140 |
-
// -----------------------------------------------------------------------
|
141 |
-
if (!empty($field['extra_class'])) {
|
142 |
-
$field['class'][] = $field['extra_class'];
|
143 |
-
}
|
144 |
-
|
145 |
-
// Clearfix
|
146 |
-
// -----------------------------------------------------------------------
|
147 |
-
if (!empty($field['clear'])) {
|
148 |
-
$field['class'][] = 'wooccm-clearfix';
|
149 |
-
}
|
150 |
-
|
151 |
-
// Required
|
152 |
-
// -----------------------------------------------------------------------
|
153 |
-
|
154 |
-
if (isset($field['required'])) {
|
155 |
-
|
156 |
-
$required = (int) $field['required'];
|
157 |
-
|
158 |
-
$field['custom_attributes']['data-required'] = $required;
|
159 |
-
|
160 |
-
if ($required) {
|
161 |
-
$field['input_class'][] = 'wooccm-required-field';
|
162 |
-
}
|
163 |
-
}
|
164 |
-
|
165 |
-
return $field;
|
166 |
-
}
|
167 |
-
|
168 |
-
public function remove_checkout_fields($fields) {
|
169 |
-
|
170 |
-
foreach ($fields as $key => $type) {
|
171 |
-
|
172 |
-
foreach ($type as $field_id => $field) {
|
173 |
-
|
174 |
-
// Remove disabled
|
175 |
-
// -------------------------------------------------------------------
|
176 |
-
if (!empty($field['disabled'])) {
|
177 |
-
unset($fields[$key][$field_id]);
|
178 |
-
}
|
179 |
-
}
|
180 |
-
}
|
181 |
-
|
182 |
-
// Fix for required address field
|
183 |
-
if (get_option('woocommerce_ship_to_destination') == 'billing_only') {
|
184 |
-
unset($fields['shipping']);
|
185 |
-
}
|
186 |
-
|
187 |
-
return $fields;
|
188 |
-
}
|
189 |
-
|
190 |
-
//function woocommerce_checkout_address_2_field($option) {
|
191 |
-
// return 'required';
|
192 |
-
//}
|
193 |
-
|
194 |
-
public function remove_fields_priority($fields) {
|
195 |
-
|
196 |
-
foreach ($fields as $key => $field) {
|
197 |
-
unset($fields[$key]['label']);
|
198 |
-
unset($fields[$key]['placeholder']);
|
199 |
-
unset($fields[$key]['priority']);
|
200 |
-
unset($fields[$key]['required']);
|
201 |
-
}
|
202 |
-
|
203 |
-
return $fields;
|
204 |
-
}
|
205 |
-
|
206 |
-
public function remove_address_fields($data) {
|
207 |
-
|
208 |
-
$remove = array(
|
209 |
-
'shipping_country',
|
210 |
-
'shipping_address_1',
|
211 |
-
'shipping_city',
|
212 |
-
'shipping_state',
|
213 |
-
'shipping_postcode'
|
214 |
-
);
|
215 |
-
|
216 |
-
foreach ($remove as $key) {
|
217 |
-
if (empty($data[$key])) {
|
218 |
-
unset($data[$key]);
|
219 |
-
}
|
220 |
-
}
|
221 |
-
|
222 |
-
return $data;
|
223 |
-
}
|
224 |
-
|
225 |
-
public function init() {
|
226 |
-
// Prepare
|
227 |
-
add_filter('wooccm_checkout_field_filter', array($this, 'add_field_filter'));
|
228 |
-
|
229 |
-
// Add field classes
|
230 |
-
add_filter('wooccm_checkout_field_filter', array($this, 'add_field_classes'));
|
231 |
-
|
232 |
-
// Remove fields
|
233 |
-
// -----------------------------------------------------------------------
|
234 |
-
add_filter('woocommerce_checkout_fields', array($this, 'remove_checkout_fields'));
|
235 |
-
|
236 |
-
// Fix address_2 field
|
237 |
-
// -----------------------------------------------------------------------
|
238 |
-
//add_filter('default_option_woocommerce_checkout_address_2_field', array($this, 'woocommerce_checkout_address_2_field'));
|
239 |
-
// Fix address fields priority, required, placeholder, label
|
240 |
-
// add_filter('woocommerce_get_country_locale', '__return_empty_array');
|
241 |
-
add_filter('woocommerce_get_country_locale_default', array($this, 'remove_fields_priority'));
|
242 |
-
add_filter('woocommerce_get_country_locale_base', array($this, 'remove_fields_priority'));
|
243 |
-
// Fix required country notice when shipping address is activated
|
244 |
-
// -----------------------------------------------------------------------
|
245 |
-
add_filter('woocommerce_checkout_posted_data', array($this, 'remove_address_fields'));
|
246 |
-
|
247 |
-
// Clear session
|
248 |
-
add_action('woocommerce_checkout_posted_data', array($this, 'posted_data'));
|
249 |
-
}
|
250 |
-
|
251 |
-
}
|
252 |
-
|
253 |
-
WOOCCM_Fields_Handler::instance();
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WOOCCM_Fields_Handler {
|
4 |
+
|
5 |
+
protected static $_instance;
|
6 |
+
|
7 |
+
public function __construct() {
|
8 |
+
$this->init();
|
9 |
+
}
|
10 |
+
|
11 |
+
public static function instance() {
|
12 |
+
if (is_null(self::$_instance)) {
|
13 |
+
self::$_instance = new self();
|
14 |
+
}
|
15 |
+
return self::$_instance;
|
16 |
+
}
|
17 |
+
|
18 |
+
public function posted_data($data) {
|
19 |
+
|
20 |
+
if (count($fields = WC()->session->wooccm['fields'])) {
|
21 |
+
|
22 |
+
foreach ($fields as $key => $field) {
|
23 |
+
|
24 |
+
switch ($field['type']) {
|
25 |
+
|
26 |
+
case 'multicheckbox':
|
27 |
+
|
28 |
+
$data[$key] = isset($_POST[$key]) ? implode(', ', wc_clean(wp_unslash($_POST[$key]))) : '';
|
29 |
+
|
30 |
+
break;
|
31 |
+
|
32 |
+
case 'checkbox':
|
33 |
+
|
34 |
+
if (!empty($_POST[$key])) {
|
35 |
+
$data[$key] = __('Yes', 'woocommerce-checkout-manager');
|
36 |
+
} else {
|
37 |
+
$data[$key] = __('No', 'woocommerce-checkout-manager');
|
38 |
+
}
|
39 |
+
|
40 |
+
break;
|
41 |
+
}
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
return $data;
|
46 |
+
}
|
47 |
+
|
48 |
+
public function add_field_filter($field) {
|
49 |
+
|
50 |
+
if (isset(WC()->session)) {
|
51 |
+
$session_data = WC()->session->wooccm;
|
52 |
+
}
|
53 |
+
|
54 |
+
// keep attr id = attr name
|
55 |
+
// -------------------------------------------------------------------------
|
56 |
+
unset($field['id']);
|
57 |
+
|
58 |
+
switch ($field['type']) {
|
59 |
+
|
60 |
+
case 'select':
|
61 |
+
case 'radio':
|
62 |
+
|
63 |
+
if (!empty($field['options'])) {
|
64 |
+
if (is_array($field['options'])) {
|
65 |
+
$field['add_price_total'] = array_column($field['options'], 'add_price_total');
|
66 |
+
$field['add_price_type'] = array_column($field['options'], 'add_price_type');
|
67 |
+
$field['add_price_tax'] = array_column($field['options'], 'add_price_tax');
|
68 |
+
$field['options'] = array_column($field['options'], 'label');
|
69 |
+
}
|
70 |
+
} else {
|
71 |
+
$field['disabled'] = true;
|
72 |
+
}
|
73 |
+
|
74 |
+
break;
|
75 |
+
|
76 |
+
case 'multiselect':
|
77 |
+
case 'multicheckbox':
|
78 |
+
|
79 |
+
if (!empty($field['options'])) {
|
80 |
+
if (is_array($field['options'])) {
|
81 |
+
$field['add_price_total'] = array_column($field['options'], 'add_price_total');
|
82 |
+
$field['add_price_type'] = array_column($field['options'], 'add_price_type');
|
83 |
+
$field['add_price_tax'] = array_column($field['options'], 'add_price_tax');
|
84 |
+
$field['default'] = array_column($field['options'], 'default');
|
85 |
+
$field['options'] = array_column($field['options'], 'label');
|
86 |
+
}
|
87 |
+
} else {
|
88 |
+
$field['disabled'] = true;
|
89 |
+
}
|
90 |
+
|
91 |
+
break;
|
92 |
+
|
93 |
+
case 'heading':
|
94 |
+
$field['required'] = false;
|
95 |
+
break;
|
96 |
+
}
|
97 |
+
|
98 |
+
// Priority
|
99 |
+
// -----------------------------------------------------------------------
|
100 |
+
if (isset($field['order'])) {
|
101 |
+
$field['priority'] = $field['order'] * 10;
|
102 |
+
}
|
103 |
+
|
104 |
+
if (isset(WC()->session)) {
|
105 |
+
$session_data['fields'][$field['key']] = $field;
|
106 |
+
WC()->session->wooccm = $session_data;
|
107 |
+
}
|
108 |
+
|
109 |
+
return $field;
|
110 |
+
}
|
111 |
+
|
112 |
+
public function add_field_classes($field) {
|
113 |
+
|
114 |
+
// Position
|
115 |
+
// -----------------------------------------------------------------------
|
116 |
+
if (!empty($field['position'])) {
|
117 |
+
$field['class'] = array_diff($field['class'], array('form-row-wide', 'form-row-first', 'form-row-last'));
|
118 |
+
$field['class'][] = $field['position'];
|
119 |
+
}
|
120 |
+
|
121 |
+
// WOOCCM
|
122 |
+
// -----------------------------------------------------------------------
|
123 |
+
|
124 |
+
$field['class'][] = 'wooccm-field';
|
125 |
+
$field['class'][] = 'wooccm-field-' . $field['name'];
|
126 |
+
|
127 |
+
// Type
|
128 |
+
// -----------------------------------------------------------------------
|
129 |
+
if (!empty($field['type'])) {
|
130 |
+
$field['class'][] = 'wooccm-type-' . $field['type'];
|
131 |
+
}
|
132 |
+
|
133 |
+
// Color
|
134 |
+
// -----------------------------------------------------------------------
|
135 |
+
if (!empty($field['type']) && $field['type'] == 'colorpicker') {
|
136 |
+
$field['class'][] = 'wooccm-colorpicker-' . $field['pickertype'];
|
137 |
+
}
|
138 |
+
|
139 |
+
// Extra
|
140 |
+
// -----------------------------------------------------------------------
|
141 |
+
if (!empty($field['extra_class'])) {
|
142 |
+
$field['class'][] = $field['extra_class'];
|
143 |
+
}
|
144 |
+
|
145 |
+
// Clearfix
|
146 |
+
// -----------------------------------------------------------------------
|
147 |
+
if (!empty($field['clear'])) {
|
148 |
+
$field['class'][] = 'wooccm-clearfix';
|
149 |
+
}
|
150 |
+
|
151 |
+
// Required
|
152 |
+
// -----------------------------------------------------------------------
|
153 |
+
|
154 |
+
if (isset($field['required'])) {
|
155 |
+
|
156 |
+
$required = (int) $field['required'];
|
157 |
+
|
158 |
+
$field['custom_attributes']['data-required'] = $required;
|
159 |
+
|
160 |
+
if ($required) {
|
161 |
+
$field['input_class'][] = 'wooccm-required-field';
|
162 |
+
}
|
163 |
+
}
|
164 |
+
|
165 |
+
return $field;
|
166 |
+
}
|
167 |
+
|
168 |
+
public function remove_checkout_fields($fields) {
|
169 |
+
|
170 |
+
foreach ($fields as $key => $type) {
|
171 |
+
|
172 |
+
foreach ($type as $field_id => $field) {
|
173 |
+
|
174 |
+
// Remove disabled
|
175 |
+
// -------------------------------------------------------------------
|
176 |
+
if (!empty($field['disabled'])) {
|
177 |
+
unset($fields[$key][$field_id]);
|
178 |
+
}
|
179 |
+
}
|
180 |
+
}
|
181 |
+
|
182 |
+
// Fix for required address field
|
183 |
+
if (get_option('woocommerce_ship_to_destination') == 'billing_only') {
|
184 |
+
unset($fields['shipping']);
|
185 |
+
}
|
186 |
+
|
187 |
+
return $fields;
|
188 |
+
}
|
189 |
+
|
190 |
+
//function woocommerce_checkout_address_2_field($option) {
|
191 |
+
// return 'required';
|
192 |
+
//}
|
193 |
+
|
194 |
+
public function remove_fields_priority($fields) {
|
195 |
+
|
196 |
+
foreach ($fields as $key => $field) {
|
197 |
+
unset($fields[$key]['label']);
|
198 |
+
unset($fields[$key]['placeholder']);
|
199 |
+
unset($fields[$key]['priority']);
|
200 |
+
unset($fields[$key]['required']);
|
201 |
+
}
|
202 |
+
|
203 |
+
return $fields;
|
204 |
+
}
|
205 |
+
|
206 |
+
public function remove_address_fields($data) {
|
207 |
+
|
208 |
+
$remove = array(
|
209 |
+
'shipping_country',
|
210 |
+
'shipping_address_1',
|
211 |
+
'shipping_city',
|
212 |
+
'shipping_state',
|
213 |
+
'shipping_postcode'
|
214 |
+
);
|
215 |
+
|
216 |
+
foreach ($remove as $key) {
|
217 |
+
if (empty($data[$key])) {
|
218 |
+
unset($data[$key]);
|
219 |
+
}
|
220 |
+
}
|
221 |
+
|
222 |
+
return $data;
|
223 |
+
}
|
224 |
+
|
225 |
+
public function init() {
|
226 |
+
// Prepare
|
227 |
+
add_filter('wooccm_checkout_field_filter', array($this, 'add_field_filter'));
|
228 |
+
|
229 |
+
// Add field classes
|
230 |
+
add_filter('wooccm_checkout_field_filter', array($this, 'add_field_classes'));
|
231 |
+
|
232 |
+
// Remove fields
|
233 |
+
// -----------------------------------------------------------------------
|
234 |
+
add_filter('woocommerce_checkout_fields', array($this, 'remove_checkout_fields'));
|
235 |
+
|
236 |
+
// Fix address_2 field
|
237 |
+
// -----------------------------------------------------------------------
|
238 |
+
//add_filter('default_option_woocommerce_checkout_address_2_field', array($this, 'woocommerce_checkout_address_2_field'));
|
239 |
+
// Fix address fields priority, required, placeholder, label
|
240 |
+
// add_filter('woocommerce_get_country_locale', '__return_empty_array');
|
241 |
+
add_filter('woocommerce_get_country_locale_default', array($this, 'remove_fields_priority'));
|
242 |
+
add_filter('woocommerce_get_country_locale_base', array($this, 'remove_fields_priority'));
|
243 |
+
// Fix required country notice when shipping address is activated
|
244 |
+
// -----------------------------------------------------------------------
|
245 |
+
add_filter('woocommerce_checkout_posted_data', array($this, 'remove_address_fields'));
|
246 |
+
|
247 |
+
// Clear session
|
248 |
+
add_action('woocommerce_checkout_posted_data', array($this, 'posted_data'));
|
249 |
+
}
|
250 |
+
|
251 |
+
}
|
252 |
+
|
253 |
+
WOOCCM_Fields_Handler::instance();
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
===
|
2 |
Contributors: quadlayers
|
3 |
Donate link: https://quadlayers.com/
|
4 |
Tags: woocommerce, woocommerce checkout, field manager, checkout editor, checkout field, shipping field, billing field, order field, additional field
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 5.4.0
|
7 |
-
Stable tag:
|
8 |
WC requires at least: 3.0
|
9 |
WC tested up to: 4.0
|
10 |
License: GPLv2 or later
|
@@ -107,6 +107,9 @@ Your Order data can be reviewed in each order within the default WooCommerce Ord
|
|
107 |
|
108 |
== Changelog ==
|
109 |
|
|
|
|
|
|
|
110 |
= 4.9.9 =
|
111 |
* Fix: woocommerce checkout multiselect default values
|
112 |
* Fix: woocommerce checkout multicheckbox default values
|
1 |
+
=== Checkout Manager for WooCommerce ===
|
2 |
Contributors: quadlayers
|
3 |
Donate link: https://quadlayers.com/
|
4 |
Tags: woocommerce, woocommerce checkout, field manager, checkout editor, checkout field, shipping field, billing field, order field, additional field
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 5.4.0
|
7 |
+
Stable tag: 5.0.0
|
8 |
WC requires at least: 3.0
|
9 |
WC tested up to: 4.0
|
10 |
License: GPLv2 or later
|
107 |
|
108 |
== Changelog ==
|
109 |
|
110 |
+
= 5.0.0 =
|
111 |
+
* Fix: woocommerce checkout conditional fields
|
112 |
+
|
113 |
= 4.9.9 =
|
114 |
* Fix: woocommerce checkout multiselect default values
|
115 |
* Fix: woocommerce checkout multicheckbox default values
|
woocommerce-checkout-manager.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/**
|
4 |
* Plugin Name: WooCommerce Checkout Manager
|
5 |
* Description: Manages WooCommerce Checkout, the advanced way.
|
6 |
-
* Version:
|
7 |
* Author: QuadLayers
|
8 |
* Author URI: https://www.quadlayers.com
|
9 |
* Copyright: 2019 QuadLayers (https://www.quadlayers.com)
|
@@ -17,7 +17,7 @@ if (!defined('WOOCCM_PLUGIN_NAME')) {
|
|
17 |
define('WOOCCM_PLUGIN_NAME', 'WooCommerce Checkout Manager');
|
18 |
}
|
19 |
if (!defined('WOOCCM_PLUGIN_VERSION')) {
|
20 |
-
define('WOOCCM_PLUGIN_VERSION', '
|
21 |
}
|
22 |
if (!defined('WOOCCM_PLUGIN_FILE')) {
|
23 |
define('WOOCCM_PLUGIN_FILE', __FILE__);
|
3 |
/**
|
4 |
* Plugin Name: WooCommerce Checkout Manager
|
5 |
* Description: Manages WooCommerce Checkout, the advanced way.
|
6 |
+
* Version: 5.0.0
|
7 |
* Author: QuadLayers
|
8 |
* Author URI: https://www.quadlayers.com
|
9 |
* Copyright: 2019 QuadLayers (https://www.quadlayers.com)
|
17 |
define('WOOCCM_PLUGIN_NAME', 'WooCommerce Checkout Manager');
|
18 |
}
|
19 |
if (!defined('WOOCCM_PLUGIN_VERSION')) {
|
20 |
+
define('WOOCCM_PLUGIN_VERSION', '5.0.0');
|
21 |
}
|
22 |
if (!defined('WOOCCM_PLUGIN_FILE')) {
|
23 |
define('WOOCCM_PLUGIN_FILE', __FILE__);
|