Version Description
- Fix: woocommerce checkout fields filter by category
- Fix: woocommerce checkout state field required
- Fix: woocommerce checkout state required hidden
Download this release
Release Info
Developer | quadlayers |
Plugin | WooCommerce Checkout Manager |
Version | 4.9.6 |
Comparing to | |
See all releases |
Code changes from version 4.9.5 to 4.9.6
- assets/frontend/js/wooccm-checkout.js +7 -1
- assets/frontend/js/wooccm-checkout.min.js +1 -0
- includes/controller/class-wooccm-order.php +1 -30
- includes/view/backend/pages/modals/parts/panel-filter.php +1 -1
- includes/view/backend/pages/parts/loop.php +4 -0
- includes/view/frontend/class-wooccm-fields-disable.php +22 -17
- includes/view/frontend/class-wooccm-fields-handler.php +13 -5
- readme.txt +27 -16
- woocommerce-checkout-manager.php +2 -2
assets/frontend/js/wooccm-checkout.js
CHANGED
@@ -68,6 +68,11 @@
|
|
68 |
'">*</abbr>'
|
69 |
);
|
70 |
}
|
|
|
|
|
|
|
|
|
|
|
71 |
} else {
|
72 |
field.find('label .required').remove();
|
73 |
field.removeClass('validate-required woocommerce-invalid woocommerce-invalid-required-field');
|
@@ -85,7 +90,8 @@
|
|
85 |
$.each(locale_fields, function (key, value) {
|
86 |
|
87 |
var field = thisform.find(value),
|
88 |
-
required = field.find('[data-required]').data('required') ||
|
|
|
89 |
field_is_required(field, required);
|
90 |
});
|
91 |
});
|
68 |
'">*</abbr>'
|
69 |
);
|
70 |
}
|
71 |
+
|
72 |
+
//fix state hidden
|
73 |
+
field.show();
|
74 |
+
field.find('input[type=hidden]').prop('type', 'text');
|
75 |
+
|
76 |
} else {
|
77 |
field.find('label .required').remove();
|
78 |
field.removeClass('validate-required woocommerce-invalid woocommerce-invalid-required-field');
|
90 |
$.each(locale_fields, function (key, value) {
|
91 |
|
92 |
var field = thisform.find(value),
|
93 |
+
required = field.find('[data-required]').data('required') || field.find('.wooccm-required-field').length;
|
94 |
+
|
95 |
field_is_required(field, required);
|
96 |
});
|
97 |
});
|
assets/frontend/js/wooccm-checkout.min.js
CHANGED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(e){var t=function(e){return e.is(".processing")||e.parents(".processing").length};e(document).on("country_to_state_changing",function(t,o,c){var i=c,n=e.parseJSON(wc_address_i18n_params.locale_fields);e.each(n,function(e,t){var o=i.find(t),c=o.find("[data-required]").data("required")||o.find(".wooccm-required-field").length;!function(e,t){t?(e.find("label .optional").remove(),e.addClass("validate-required"),0===e.find("label .required").length&&e.find("label").append('<abbr class="required" title="'+wc_address_i18n_params.i18n_required_text+'">*</abbr>'),e.show(),e.find("input[type=hidden]").prop("type","text")):(e.find("label .required").remove(),e.removeClass("validate-required woocommerce-invalid woocommerce-invalid-required-field"),0===e.find("label .optional").length&&e.find("label").append('<span class="optional">('+wc_address_i18n_params.i18n_optional_text+")</span>"))}(o,c)})});var o={};if(e(".wooccm-type-file").each(function(t,c){var i=e(c),n=i.find("[type=file]"),a=i.find(".wooccm-file-button"),r=i.find(".wooccm-file-list");o[i.attr("id")]=[],a.on("click",function(e){e.preventDefault(),n.trigger("click")}),r.on("click",".wooccm-file-list-delete",function(t){var c=e(this).closest(".wooccm-file-file"),n=e(this).closest("[data-file_id]").data("file_id");o[i.attr("id")]=e.grep(o[i.attr("id")],function(e,t){return t!=n}),c.remove(),e("#order_review").trigger("wooccm_upload")}),n.on("change",function(t){var c=e(this)[0].files;c.length&&window.FileReader&&e.each(c,function(t,c){var n;return r.find("span[data-file_id]").length+t>=wooccm_upload.limit.max_files?(alert("Exeeds max files limit of "+wooccm_upload.limit.max_files),!1):c.size>wooccm_upload.limit.max_file_size?(alert("Exeeds max file size of "+wooccm_upload.limit.max_file_size),!0):(reader=new FileReader,reader.onload=(n=c,function(t){setTimeout(function(){!function(t,o,c,i,n){var a,r=e(t);n.match("image.*")?a="image":n.match("application/ms.*")?(c=wooccm_upload.icons.spreadsheet,a="spreadsheet"):n.match("application/x.*")?(c=wooccm_upload.icons.archive,a="application"):n.match("audio.*")?(c=wooccm_upload.icons.audio,a="audio"):n.match("text.*")?(c=wooccm_upload.icons.text,a="text"):n.match("video.*")?(c=wooccm_upload.icons.video,a="video"):(c=wooccm_upload.icons.interactive,a="interactive");var s='<span data-file_id="'+o+'" title="'+i+'" class="wooccm-file-file">\n <span class="wooccm-file-list-container">\n <a title="'+i+'" class="wooccm-file-list-delete">×</a>\n <span class="wooccm-file-list-image-container">\n <img class="'+a+'" alt="'+i+'" src="'+c+'"/>\n </span>\n </span>\n </span>';r.append(s).fadeIn()}(r,o[i.attr("id")].push(c)-1,t.target.result,n.name,n.type),e("#order_review").trigger("wooccm_upload")},200)}),console.log(c.name),void reader.readAsDataURL(c))})})}),e("#order_review").on("ajaxSuccess wooccm_upload",function(t){var o=e(t.target).find("#place_order");e(".wooccm-type-file").length?o.addClass("wooccm-upload-process"):o.removeClass("wooccm-upload-process")}),e(document).on("click","#place_order.wooccm-upload-process",function(c){c.preventDefault();var i,n=e("form.checkout"),a=e(this);e(".wooccm-type-file").length&&(window.FormData&&Object.keys(o).length&&(t(n)||(a.html(wooccm_upload.message.uploading),t(i=n)||i.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})),e.each(o,function(t,o){var c=e("#"+t).find(".wooccm-file-field"),i=new FormData;e.each(o,function(e,t){return e>wooccm_upload.limit.max_files?(console.log("Exeeds max files limit of "+wooccm_upload.limit.max_files),!1):t.size>wooccm_upload.limit.max_file_size?(console.log("Exeeds max file size of "+wooccm_upload.limit.max_files),!0):(console.log("We're ready to upload "+t.name),void i.append("wooccm_checkout_attachment_upload[]",t))}),i.append("action","wooccm_checkout_attachment_upload"),i.append("nonce",wooccm_upload.nonce),e.ajax({async:!1,url:wooccm_upload.ajax_url,type:"POST",cache:!1,data:i,processData:!1,contentType:!1,beforeSend:function(e){},success:function(t){t.success?c.val(t.data):e("body").trigger("update_checkout")},complete:function(e){}})}),function(e){e.removeClass("processing").unblock()}(n),a.removeClass("wooccm-upload-process").trigger("click")))}),e(document).on("change",".wooccm-add-price",function(t){e("body").trigger("update_checkout")}),e(".wooccm-conditional-child").each(function(t,o){var c=e(o),i=e("#"+c.find("[data-conditional-parent]").data("conditional-parent")+"_field"),n=c.find("[data-conditional-parent-value]").data("conditional-parent-value").toString();i.length?(i.on("wooccm_change change keyup",function(t){var o=e(t.target),a=o.val();o.hasClass("select2-selection")||("checkbox"==o.prop("type")&&(a=-1!==o.attr("name").indexOf("[]")?i.find("input:checked").map(function(e,t){return t.value}).toArray():o.is(":checked")),n==a||e.isArray(a)&&a.indexOf(n)>-1?c.fadeIn():c.fadeOut(),o.off("wooccm_change"),o.off("change"),o.off("keyup"),c.trigger("change"))}),i.find("select:first").trigger("wooccm_change"),i.find("textarea:first").trigger("wooccm_change"),i.find("input[type=button]:first").trigger("wooccm_change"),i.find("input[type=radio]:checked:first").trigger("wooccm_change"),i.find("input[type=checkbox]:checked:first").trigger("wooccm_change"),i.find("input[type=color]:first").trigger("wooccm_change"),i.find("input[type=date]:first").trigger("wooccm_change"),i.find("input[type=datetime-local]:first").trigger("wooccm_change"),i.find("input[type=email]:first").trigger("wooccm_change"),i.find("input[type=file]:first").trigger("wooccm_change"),i.find("input[type=hidden]:first").trigger("wooccm_change"),i.find("input[type=image]:first").trigger("wooccm_change"),i.find("input[type=month]:first").trigger("wooccm_change"),i.find("input[type=number]:first").trigger("wooccm_change"),i.find("input[type=password]:first").trigger("wooccm_change"),i.find("input[type=range]:first").trigger("wooccm_change"),i.find("input[type=reset]:first").trigger("wooccm_change"),i.find("input[type=search]:first").trigger("wooccm_change"),i.find("input[type=submit]:first").trigger("wooccm_change"),i.find("input[type=tel]:first").trigger("wooccm_change"),i.find("input[type=text]:first").trigger("wooccm_change"),i.find("input[type=time]:first").trigger("wooccm_change"),i.find("input[type=url]:first").trigger("wooccm_change"),i.find("input[type=week]:first").trigger("wooccm_change")):c.show()}),e(".wooccm-enhanced-datepicker").each(function(t,o){var c=e(this),i=c.data("disable")||!1;e.isFunction(e.fn.datepicker)&&c.datepicker({dateFormat:c.data("formatdate")||"dd-mm-yy",minDate:c.data("mindate")||void 0,maxDate:c.data("maxdate")||void 0,beforeShowDay:function(t){var o=t.getDay().toString();return i?[-1===e.inArray(o,i)]:[!0]}})}),e(".wooccm-enhanced-timepicker").each(function(t,o){var c=e(this);e.isFunction(e.fn.timepicker)&&c.timepicker({showPeriod:!0,showLeadingZero:!0,hours:c.data("hours")||void 0,minutes:c.data("minutes")||void 0})}),e(".wooccm-colorpicker-farbtastic").each(function(t,o){var c=e(o),i=c.find("input[type=text]"),n=c.find(".wooccmcolorpicker_container");i.hide(),e.isFunction(e.fn.farbtastic)&&(n.farbtastic("#"+i.attr("id")),n.on("click",function(e){i.fadeIn()}))}),e(".wooccm-colorpicker-iris").each(function(t,o){var c=e(o),i=c.find("input[type=text]");i.css("background",i.val()),i.on("click",function(e){c.toggleClass("active")}),i.iris({class:i.attr("id"),palettes:!0,color:"",hide:!1,change:function(e,t){i.css("background",t.color.toString()).fadeIn()}})}),e(document).on("click",function(t){0===e(t.target).closest(".iris-picker").length&&e(".wooccm-colorpicker-iris").removeClass("active")}),"undefined"==typeof wc_country_select_params)return!1;if(e().selectWoo){e("select.wooccm-enhanced-select").each(function(){var t=e.extend({width:"100%",placeholder:e(this).data("placeholder")||"",allowClear:e(this).data("allowclear")||!1,selectOnClose:e(this).data("selectonclose")||!1,closeOnSelect:e(this).data("closeonselect")||!1,minimumResultsForSearch:e(this).data("search")||-1},{language:{errorLoading:function(){return wc_country_select_params.i18n_searching},inputTooLong:function(e){var t=e.input.length-e.maximum;return 1===t?wc_country_select_params.i18n_input_too_long_1:wc_country_select_params.i18n_input_too_long_n.replace("%qty%",t)},inputTooShort:function(e){var t=e.minimum-e.input.length;return 1===t?wc_country_select_params.i18n_input_too_short_1:wc_country_select_params.i18n_input_too_short_n.replace("%qty%",t)},loadingMore:function(){return wc_country_select_params.i18n_load_more},maximumSelected:function(e){return 1===e.maximum?wc_country_select_params.i18n_selection_too_long_1:wc_country_select_params.i18n_selection_too_long_n.replace("%qty%",e.maximum)},noResults:function(){return wc_country_select_params.i18n_no_matches},searching:function(){return wc_country_select_params.i18n_searching}}});e(this).on("select2:select",function(){e(this).focus()}).selectWoo(t)})}}(jQuery);
|
includes/controller/class-wooccm-order.php
CHANGED
@@ -72,36 +72,7 @@ class WOOCCM_Order_Controller extends WOOCCM_Upload {
|
|
72 |
}
|
73 |
|
74 |
wp_send_json_success(ob_get_clean());
|
75 |
-
|
76 |
-
$email_recipients = $options['checkness']['wooccm_notification_email'];
|
77 |
-
if (empty($email_recipients))
|
78 |
-
$email_recipients = get_option('admin_email');
|
79 |
-
$email_heading = __('Files Uploaded by Customer', 'woocommerce-checkout-manager');
|
80 |
-
$subject = sprintf(__('WooCommerce Checkout Manager - %s [%s]', 'woocommerce-checkout-manager'), $email_heading, $order->billing_first_name . ' ' . $order->billing_last_name);
|
81 |
-
|
82 |
-
$mailer = WC()->mailer();
|
83 |
-
|
84 |
-
// Buffer
|
85 |
-
ob_start();
|
86 |
-
?>
|
87 |
-
<p>This is an automatic message from WooCommerce Checkout Manager, reporting that files have been uploaded by <?php echo $order->billing_first_name; ?> <?php echo $order->billing_last_name; ?>.</p>
|
88 |
-
<h3>Customer Details</h3>
|
89 |
-
<ul>
|
90 |
-
<li>Name: <?php echo $order->billing_first_name; ?> <?php $order->billing_last_name; ?></li>
|
91 |
-
<li>E-mail: <?php echo $order->billing_email; ?></li>
|
92 |
-
<li>Order Number: <?php echo $order_id; ?></li>
|
93 |
-
</ul>
|
94 |
-
<p>You can view the files and order details via back-end by following this <a href="<?php echo admin_url('/post.php?post=' . $order_id . '&action=edit'); ?>" target="_blank">link</a>.</p>
|
95 |
-
<?php
|
96 |
-
// Get contents
|
97 |
-
$message = ob_get_clean();
|
98 |
-
|
99 |
-
$message = $mailer->wrap_message($email_heading, $message);
|
100 |
-
|
101 |
-
// add_filter( 'wp_mail_content_type', 'wooccm_set_html_content_type' );
|
102 |
-
// wc_mail( $email_recipients, $subject, $message );
|
103 |
-
$mailer->send($email_recipients, strip_tags($subject), $message);
|
104 |
-
// remove_filter( 'wp_mail_content_type', 'wooccm_set_html_content_type' ); */
|
105 |
}
|
106 |
wp_send_json_error(esc_html__('Unknow error.', 'woocommerce-checkout-manager'));
|
107 |
}
|
72 |
}
|
73 |
|
74 |
wp_send_json_success(ob_get_clean());
|
75 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
}
|
77 |
wp_send_json_error(esc_html__('Unknow error.', 'woocommerce-checkout-manager'));
|
78 |
}
|
includes/view/backend/pages/modals/parts/panel-filter.php
CHANGED
@@ -61,7 +61,7 @@
|
|
61 |
<select class="wooccm-enhanced-select" name="show_product_cat[]" data-placeholder="<?php esc_attr_e('Filter by categories', 'woocommerce-checkout-manager'); ?>" data-selected="{{data.show_product_cat}}" data-allow_clear="true" multiple="multiple">
|
62 |
<?php if ($product_categories) : ?>
|
63 |
<?php foreach ($product_categories as $category): ?>
|
64 |
-
<option <# if ( _.contains(data.show_product_cat, '<?php echo esc_attr($category->
|
65 |
<?php endforeach; ?>
|
66 |
<?php endif; ?>
|
67 |
</select>
|
61 |
<select class="wooccm-enhanced-select" name="show_product_cat[]" data-placeholder="<?php esc_attr_e('Filter by categories', 'woocommerce-checkout-manager'); ?>" data-selected="{{data.show_product_cat}}" data-allow_clear="true" multiple="multiple">
|
62 |
<?php if ($product_categories) : ?>
|
63 |
<?php foreach ($product_categories as $category): ?>
|
64 |
+
<option <# if ( _.contains(data.show_product_cat, '<?php echo esc_attr($category->term_id); ?>') ) { #>selected="selected"<# } #> value="<?php echo esc_attr($category->term_id); ?>"><?php echo esc_html($category->name); ?></option>
|
65 |
<?php endforeach; ?>
|
66 |
<?php endif; ?>
|
67 |
</select>
|
includes/view/backend/pages/parts/loop.php
CHANGED
@@ -12,6 +12,7 @@
|
|
12 |
<th class="type" style="width:1%"><?php esc_html_e('Type', 'woocommerce-checkout-manager'); ?></th>
|
13 |
<th class="label" style="width:1%;min-width: 100px;"><?php esc_html_e('Label', 'woocommerce-checkout-manager'); ?></th>
|
14 |
<th class="placeholder"><?php esc_html_e('Placeholder', 'woocommerce-checkout-manager'); ?></th>
|
|
|
15 |
<!--<th class="listable"><?php esc_html_e('Listable', 'woocommerce-checkout-manager'); ?></th>
|
16 |
<th class="sortable"><?php esc_html_e('Sortable', 'woocommerce-checkout-manager'); ?></th>
|
17 |
<th class="filterable"><?php esc_html_e('Filterable', 'woocommerce-checkout-manager'); ?></th>-->
|
@@ -68,6 +69,9 @@
|
|
68 |
</td>
|
69 |
<td class="placeholder">
|
70 |
<?php echo esc_html($field['placeholder']); ?>
|
|
|
|
|
|
|
71 |
</td>
|
72 |
<!--<td class="listable">
|
73 |
<?php
|
12 |
<th class="type" style="width:1%"><?php esc_html_e('Type', 'woocommerce-checkout-manager'); ?></th>
|
13 |
<th class="label" style="width:1%;min-width: 100px;"><?php esc_html_e('Label', 'woocommerce-checkout-manager'); ?></th>
|
14 |
<th class="placeholder"><?php esc_html_e('Placeholder', 'woocommerce-checkout-manager'); ?></th>
|
15 |
+
<th class="id" style="width:1%;"><?php esc_html_e('ID', 'woocommerce-checkout-manager'); ?></th>
|
16 |
<!--<th class="listable"><?php esc_html_e('Listable', 'woocommerce-checkout-manager'); ?></th>
|
17 |
<th class="sortable"><?php esc_html_e('Sortable', 'woocommerce-checkout-manager'); ?></th>
|
18 |
<th class="filterable"><?php esc_html_e('Filterable', 'woocommerce-checkout-manager'); ?></th>-->
|
69 |
</td>
|
70 |
<td class="placeholder">
|
71 |
<?php echo esc_html($field['placeholder']); ?>
|
72 |
+
</td>
|
73 |
+
<td class="id">
|
74 |
+
<?php echo esc_html($field['key']); ?>
|
75 |
</td>
|
76 |
<!--<td class="listable">
|
77 |
<?php
|
includes/view/frontend/class-wooccm-fields-disable.php
CHANGED
@@ -51,21 +51,23 @@ class WOOCCM_Fields_Display {
|
|
51 |
$hide_cats_array = (array) $field['hide_product_cat'];
|
52 |
|
53 |
$show_cats_array = (array) $field['show_product_cat'];
|
|
|
|
|
54 |
|
55 |
$product_cats = array();
|
56 |
|
57 |
foreach ($cart_contents as $key => $values) {
|
58 |
-
if ($cats = wp_get_post_terms($values['product_id'], 'product_cat', array('
|
59 |
-
$product_cats
|
60 |
}
|
61 |
}
|
62 |
|
63 |
// field without more
|
64 |
// -------------------------------------------------------------------
|
65 |
-
if (
|
66 |
// hide field
|
67 |
// -----------------------------------------------------------------
|
68 |
-
if (
|
69 |
if (array_intersect($product_cats, $hide_cats_array)) {
|
70 |
$field['disabled'] = true;
|
71 |
}
|
@@ -73,7 +75,7 @@ class WOOCCM_Fields_Display {
|
|
73 |
|
74 |
// show field
|
75 |
// -----------------------------------------------------------------
|
76 |
-
if (
|
77 |
if (!array_intersect($product_cats, $show_cats_array)) {
|
78 |
$field['disabled'] = true;
|
79 |
} else {
|
@@ -84,11 +86,11 @@ class WOOCCM_Fields_Display {
|
|
84 |
|
85 |
// field with more
|
86 |
// -------------------------------------------------------------------
|
87 |
-
if (
|
88 |
|
89 |
// hide field
|
90 |
// -------------------------------------------------------------
|
91 |
-
if (
|
92 |
if (array_intersect($product_cats, $hide_cats_array)) {
|
93 |
$field['disabled'] = true;
|
94 |
}
|
@@ -96,7 +98,8 @@ class WOOCCM_Fields_Display {
|
|
96 |
|
97 |
// show field
|
98 |
// ---------------------------------------------------------------
|
99 |
-
if (
|
|
|
100 |
if (!array_intersect($product_cats, $show_cats_array)) {
|
101 |
$field['disabled'] = true;
|
102 |
} else {
|
@@ -119,25 +122,27 @@ class WOOCCM_Fields_Display {
|
|
119 |
$hide_ids_array = (array) $field['hide_product'];
|
120 |
|
121 |
$show_ids_array = (array) $field['show_product'];
|
|
|
|
|
122 |
|
123 |
$product_ids = array_column($cart_contents, 'product_id');
|
124 |
|
125 |
// field without more
|
126 |
// -------------------------------------------------------------------
|
127 |
-
if (
|
128 |
// hide field
|
129 |
// -----------------------------------------------------------------
|
130 |
-
if (
|
131 |
if (array_intersect($product_ids, $hide_ids_array)) {
|
132 |
-
|
133 |
}
|
134 |
}
|
135 |
|
136 |
// show field
|
137 |
// -----------------------------------------------------------------
|
138 |
-
if (
|
139 |
if (!array_intersect($product_ids, $show_ids_array)) {
|
140 |
-
|
141 |
} else {
|
142 |
$field['disabled'] = false;
|
143 |
}
|
@@ -146,12 +151,12 @@ class WOOCCM_Fields_Display {
|
|
146 |
|
147 |
// field with more
|
148 |
// -------------------------------------------------------------------
|
149 |
-
if (
|
150 |
|
151 |
// hide field
|
152 |
// -------------------------------------------------------------
|
153 |
-
if (
|
154 |
-
|
155 |
if (array_intersect($product_ids, $hide_ids_array)) {
|
156 |
$field['disabled'] = true;
|
157 |
}
|
@@ -159,7 +164,7 @@ class WOOCCM_Fields_Display {
|
|
159 |
|
160 |
// show field
|
161 |
// ---------------------------------------------------------------
|
162 |
-
if (
|
163 |
if (!array_intersect($product_ids, $show_ids_array)) {
|
164 |
$field['disabled'] = true;
|
165 |
} else {
|
51 |
$hide_cats_array = (array) $field['hide_product_cat'];
|
52 |
|
53 |
$show_cats_array = (array) $field['show_product_cat'];
|
54 |
+
|
55 |
+
$more_product = empty($field['more_product']);
|
56 |
|
57 |
$product_cats = array();
|
58 |
|
59 |
foreach ($cart_contents as $key => $values) {
|
60 |
+
if ($cats = wp_get_post_terms($values['product_id'], 'product_cat', array('fields' => 'ids'))) {
|
61 |
+
$product_cats = array_merge($product_cats, $cats);
|
62 |
}
|
63 |
}
|
64 |
|
65 |
// field without more
|
66 |
// -------------------------------------------------------------------
|
67 |
+
if ($more_product && count($cart_contents) < 2) {
|
68 |
// hide field
|
69 |
// -----------------------------------------------------------------
|
70 |
+
if (count($hide_cats_array)) {
|
71 |
if (array_intersect($product_cats, $hide_cats_array)) {
|
72 |
$field['disabled'] = true;
|
73 |
}
|
75 |
|
76 |
// show field
|
77 |
// -----------------------------------------------------------------
|
78 |
+
if (count($show_cats_array)) {
|
79 |
if (!array_intersect($product_cats, $show_cats_array)) {
|
80 |
$field['disabled'] = true;
|
81 |
} else {
|
86 |
|
87 |
// field with more
|
88 |
// -------------------------------------------------------------------
|
89 |
+
if (!$more_product) {
|
90 |
|
91 |
// hide field
|
92 |
// -------------------------------------------------------------
|
93 |
+
if (count($hide_cats_array)) {
|
94 |
if (array_intersect($product_cats, $hide_cats_array)) {
|
95 |
$field['disabled'] = true;
|
96 |
}
|
98 |
|
99 |
// show field
|
100 |
// ---------------------------------------------------------------
|
101 |
+
if (count($show_cats_array)) {
|
102 |
+
|
103 |
if (!array_intersect($product_cats, $show_cats_array)) {
|
104 |
$field['disabled'] = true;
|
105 |
} else {
|
122 |
$hide_ids_array = (array) $field['hide_product'];
|
123 |
|
124 |
$show_ids_array = (array) $field['show_product'];
|
125 |
+
|
126 |
+
$more_product = empty($field['more_product']);
|
127 |
|
128 |
$product_ids = array_column($cart_contents, 'product_id');
|
129 |
|
130 |
// field without more
|
131 |
// -------------------------------------------------------------------
|
132 |
+
if ($more_product && count($cart_contents) < 2) {
|
133 |
// hide field
|
134 |
// -----------------------------------------------------------------
|
135 |
+
if (count($hide_ids_array)) {
|
136 |
if (array_intersect($product_ids, $hide_ids_array)) {
|
137 |
+
$field['disabled'] = true;
|
138 |
}
|
139 |
}
|
140 |
|
141 |
// show field
|
142 |
// -----------------------------------------------------------------
|
143 |
+
if (count($show_ids_array)) {
|
144 |
if (!array_intersect($product_ids, $show_ids_array)) {
|
145 |
+
$field['disabled'] = true;
|
146 |
} else {
|
147 |
$field['disabled'] = false;
|
148 |
}
|
151 |
|
152 |
// field with more
|
153 |
// -------------------------------------------------------------------
|
154 |
+
if (!$more_product) {
|
155 |
|
156 |
// hide field
|
157 |
// -------------------------------------------------------------
|
158 |
+
if (count($hide_ids_array)) {
|
159 |
+
|
160 |
if (array_intersect($product_ids, $hide_ids_array)) {
|
161 |
$field['disabled'] = true;
|
162 |
}
|
164 |
|
165 |
// show field
|
166 |
// ---------------------------------------------------------------
|
167 |
+
if (count($show_ids_array)) {
|
168 |
if (!array_intersect($product_ids, $show_ids_array)) {
|
169 |
$field['disabled'] = true;
|
170 |
} else {
|
includes/view/frontend/class-wooccm-fields-handler.php
CHANGED
@@ -109,7 +109,7 @@ class WOOCCM_Fields_Handler {
|
|
109 |
if (isset($field['order'])) {
|
110 |
$field['priority'] = $field['order'] * 10;
|
111 |
}
|
112 |
-
|
113 |
if (isset(WC()->session)) {
|
114 |
$session_data['fields'][$field['key']] = $field;
|
115 |
WC()->session->wooccm = $session_data;
|
@@ -161,7 +161,14 @@ class WOOCCM_Fields_Handler {
|
|
161 |
// -----------------------------------------------------------------------
|
162 |
|
163 |
if (isset($field['required'])) {
|
164 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
}
|
166 |
|
167 |
return $field;
|
@@ -196,8 +203,8 @@ class WOOCCM_Fields_Handler {
|
|
196 |
public function remove_fields_priority($fields) {
|
197 |
|
198 |
foreach ($fields as $key => $field) {
|
199 |
-
|
200 |
-
|
201 |
unset($fields[$key]['priority']);
|
202 |
unset($fields[$key]['required']);
|
203 |
}
|
@@ -238,7 +245,8 @@ class WOOCCM_Fields_Handler {
|
|
238 |
// Fix address_2 field
|
239 |
// -----------------------------------------------------------------------
|
240 |
//add_filter('default_option_woocommerce_checkout_address_2_field', array($this, 'woocommerce_checkout_address_2_field'));
|
241 |
-
// Fix address fields priority
|
|
|
242 |
add_filter('woocommerce_get_country_locale_default', array($this, 'remove_fields_priority'));
|
243 |
add_filter('woocommerce_get_country_locale_base', array($this, 'remove_fields_priority'));
|
244 |
// Fix required country notice when shipping address is activated
|
109 |
if (isset($field['order'])) {
|
110 |
$field['priority'] = $field['order'] * 10;
|
111 |
}
|
112 |
+
|
113 |
if (isset(WC()->session)) {
|
114 |
$session_data['fields'][$field['key']] = $field;
|
115 |
WC()->session->wooccm = $session_data;
|
161 |
// -----------------------------------------------------------------------
|
162 |
|
163 |
if (isset($field['required'])) {
|
164 |
+
|
165 |
+
$required = (int) $field['required'];
|
166 |
+
|
167 |
+
$field['custom_attributes']['data-required'] = $required;
|
168 |
+
|
169 |
+
if ($required) {
|
170 |
+
$field['input_class'][] = 'wooccm-required-field';
|
171 |
+
}
|
172 |
}
|
173 |
|
174 |
return $field;
|
203 |
public function remove_fields_priority($fields) {
|
204 |
|
205 |
foreach ($fields as $key => $field) {
|
206 |
+
unset($fields[$key]['label']);
|
207 |
+
unset($fields[$key]['placeholder']);
|
208 |
unset($fields[$key]['priority']);
|
209 |
unset($fields[$key]['required']);
|
210 |
}
|
245 |
// Fix address_2 field
|
246 |
// -----------------------------------------------------------------------
|
247 |
//add_filter('default_option_woocommerce_checkout_address_2_field', array($this, 'woocommerce_checkout_address_2_field'));
|
248 |
+
// Fix address fields priority, required, placeholder, label
|
249 |
+
// add_filter('woocommerce_get_country_locale', '__return_empty_array');
|
250 |
add_filter('woocommerce_get_country_locale_default', array($this, 'remove_fields_priority'));
|
251 |
add_filter('woocommerce_get_country_locale_base', array($this, 'remove_fields_priority'));
|
252 |
// Fix required country notice when shipping address is activated
|
readme.txt
CHANGED
@@ -4,52 +4,58 @@ 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.3.2
|
7 |
-
Stable tag: 4.9.
|
8 |
WC requires at least: 3.0
|
9 |
WC tested up to: 3.9
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
13 |
-
|
14 |
|
15 |
-
==
|
16 |
|
17 |
[Premium](https://quadlayers.com/portfolio/woocommerce-checkout-manager/) | [Demo](https://quadlayers.com/woocommerce-checkout-manager/checkout/?add-to-cart=32) | [Documentation](https://quadlayers.com/documentation/woocommerce-checkout-manager/) | [Community](https://www.facebook.com/groups/quadlayers/)
|
18 |
|
19 |
-
WooCommerce
|
|
|
|
|
20 |
|
21 |
-
|
|
|
|
|
|
|
22 |
|
23 |
-
WooCommerce Checkout
|
24 |
|
25 |
-
|
26 |
-
This option allows you to remove the toggle checkbox to display the shipping fields. Shipping fields will be always displayed and the user will be forced to complete them.
|
27 |
|
28 |
-
= Force
|
29 |
-
This option allows you to remove the
|
|
|
|
|
|
|
30 |
|
31 |
= Remove order notes =
|
32 |
This option allows you to remove the order notes in the checkout form.
|
33 |
|
34 |
= Add message before checkout =
|
35 |
-
This option allows you to include a custom message before or after the checkout form.
|
36 |
|
37 |
== WooCommerce Checkout Fields ==
|
38 |
|
39 |
-
WooCommerce Checkout Manager allows you to include custom fields to the checkout page
|
40 |
|
41 |
-
Our plugin
|
42 |
|
43 |
== WooCommerce Checkout Conditional Fields ==
|
44 |
|
45 |
-
WooCommerce Checkout Manager supports conditional checkout fields allowing you to show/hide the fields based on
|
46 |
|
47 |
Our system detects the parent field type and allows you to select the value based on the available options.
|
48 |
|
49 |
== WooCommerce Checkout Upload Files ==
|
50 |
|
51 |
-
You can include an unlimited number of
|
52 |
-
page.
|
53 |
|
54 |
== Frequently Asked Questions ==
|
55 |
|
@@ -101,6 +107,11 @@ Your Order data can be reviewed in each order within the default WooCommerce Ord
|
|
101 |
|
102 |
== Changelog ==
|
103 |
|
|
|
|
|
|
|
|
|
|
|
104 |
= 4.9.5 =
|
105 |
* Fix: woocommerce checkout order fields before country switch
|
106 |
|
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.3.2
|
7 |
+
Stable tag: 4.9.6
|
8 |
WC requires at least: 3.0
|
9 |
WC tested up to: 3.9
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
13 |
+
WooCommerce Checkout manager is the most advanced way to customize checkout, manage checkout editor.
|
14 |
|
15 |
+
== Presentation==
|
16 |
|
17 |
[Premium](https://quadlayers.com/portfolio/woocommerce-checkout-manager/) | [Demo](https://quadlayers.com/woocommerce-checkout-manager/checkout/?add-to-cart=32) | [Documentation](https://quadlayers.com/documentation/woocommerce-checkout-manager/) | [Community](https://www.facebook.com/groups/quadlayers/)
|
18 |
|
19 |
+
WooCommerce checkout manager is a plugin built to be the wizard of checkout pages. Helps to modify in an intuitive way, allows fields customization, to extend bill�s information and to create any field required at WooCommerce checkout.
|
20 |
+
|
21 |
+
== Description ==
|
22 |
|
23 |
+
WooCommerce Checkout Manager customization and field's management alternatives:
|
24 |
+
* Re-order fields.
|
25 |
+
* Rename and higlight.
|
26 |
+
* Hide or extend Checkout fields within the Billing, Shipping and Additional sections.
|
27 |
|
28 |
+
== WooCommerce Checkout process==
|
29 |
|
30 |
+
WooCommerce Checkout Manager allows you to customize the checkout process, including or reducing steps. Our plugin is able to consider your billing process inside checkout page, and recovers all data required by your company process.
|
|
|
31 |
|
32 |
+
= Force to include shipping address =
|
33 |
+
This option allows you to remove the toggle checkbox to display the shipping fields. Shipping fields will be always displayed, and the user is forced to complete them.
|
34 |
+
|
35 |
+
= Force to create an account =
|
36 |
+
This option allows you to remove/include, the account creation during the purchase process. If selected, the account will be always created with the email defined by the user in the billing fields.
|
37 |
|
38 |
= Remove order notes =
|
39 |
This option allows you to remove the order notes in the checkout form.
|
40 |
|
41 |
= Add message before checkout =
|
42 |
+
This option allows you to include a custom message before or after the checkout form. This works as engagement action message to grateful your customers.
|
43 |
|
44 |
== WooCommerce Checkout Fields ==
|
45 |
|
46 |
+
WooCommerce Checkout Manager allows you to include custom fields to the checkout page, related to billing, Shipping or Additional fields sections.
|
47 |
|
48 |
+
Our plugin allows to reorder, remove or change the field type of the WooCommerce core fields. You can choose between this field types: Text, Textarea, Password, Radio, Checkbox, Select, Country, State, Multiselect, Multicheckbox, Heading, Colorpicker, File uploader.
|
49 |
|
50 |
== WooCommerce Checkout Conditional Fields ==
|
51 |
|
52 |
+
WooCommerce Checkout Manager supports conditional checkout fields allowing you to show/hide the fields based on any value of its parent fields.
|
53 |
|
54 |
Our system detects the parent field type and allows you to select the value based on the available options.
|
55 |
|
56 |
== WooCommerce Checkout Upload Files ==
|
57 |
|
58 |
+
You can include an unlimited number of files from different types into fields. Then offer the user an option to display the uploaded files in order. The user will be allowed to upload or delete fields through the order page.
|
|
|
59 |
|
60 |
== Frequently Asked Questions ==
|
61 |
|
107 |
|
108 |
== Changelog ==
|
109 |
|
110 |
+
= 4.9.6 =
|
111 |
+
* Fix: woocommerce checkout fields filter by category
|
112 |
+
* Fix: woocommerce checkout state field required
|
113 |
+
* Fix: woocommerce checkout state required hidden
|
114 |
+
|
115 |
= 4.9.5 =
|
116 |
* Fix: woocommerce checkout order fields before country switch
|
117 |
|
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: 4.9.
|
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', '4.9.
|
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: 4.9.6
|
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', '4.9.6');
|
21 |
}
|
22 |
if (!defined('WOOCCM_PLUGIN_FILE')) {
|
23 |
define('WOOCCM_PLUGIN_FILE', __FILE__);
|