Changeset 3291675
- Timestamp:
- 05/12/2025 08:51:32 AM (7 months ago)
- Location:
- woo-checkout-field-editor-pro/trunk
- Files:
-
- 6 edited
-
block/class-thwcfd-block.php (modified) (1 diff)
-
checkout-form-designer.php (modified) (3 diffs)
-
languages/woo-checkout-field-editor-pro.pot (modified) (4 diffs)
-
public/assets/js/thwcfd-public.min.js (modified) (1 diff)
-
public/class-thwcfd-public-checkout.php (modified) (3 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woo-checkout-field-editor-pro/trunk/block/class-thwcfd-block.php
r3253231 r3291675 175 175 $field['optionalLabel'] = $field_set[$key]['label']?? $field['optionalLabel']; 176 176 }else{ 177 $field['optionalLabel'] = $field_set[$key]['label']? $field_set[$key]['label'].' (optional)' : $field['optionalLabel']; 177 //$field['optionalLabel'] = $field_set[$key]['label']? $field_set[$key]['label'].' (optional)' : $field['optionalLabel']; 178 $field['optionalLabel'] = !empty($field_set[$key]['label']) ? sprintf( 179 /* translators: %s Field label. */ 180 __( '%s (optional)', 'woo-checkout-field-editor-pro' ), 181 $field_set[$key]['label'] 182 ) : $field['optionalLabel']; 178 183 } 179 184 $field['required'] = $field_set[$key]['required'] ?? $field['required']; -
woo-checkout-field-editor-pro/trunk/checkout-form-designer.php
r3253231 r3291675 4 4 * Description: Customize WooCommerce checkout fields(Add, Edit, Delete and re-arrange fields). 5 5 * Author: ThemeHigh 6 * Version: 2.1. 36 * Version: 2.1.4 7 7 * Author URI: https://www.themehigh.com 8 8 * Plugin URI: https://www.themehigh.com … … 10 10 * Domain Path: /languages 11 11 * WC requires at least: 3.0.0 12 * WC tested up to: 9. 712 * WC tested up to: 9.8 13 13 */ 14 14 … … 26 26 27 27 if(is_woocommerce_active()) { 28 define('THWCFD_VERSION', '2.1. 3');28 define('THWCFD_VERSION', '2.1.4'); 29 29 !defined('THWCFD_BASE_NAME') && define('THWCFD_BASE_NAME', plugin_basename( __FILE__ )); 30 30 !defined('THWCFD_PATH') && define('THWCFD_PATH', plugin_dir_path( __FILE__ )); -
woo-checkout-field-editor-pro/trunk/languages/woo-checkout-field-editor-pro.pot
r3253231 r3291675 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Checkout Field Editor for WooCommerce 2.1. 2\n"5 "Project-Id-Version: Checkout Field Editor for WooCommerce 2.1.3\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woo-checkout-field-editor-pro\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2025-0 2-27T11:58:24+00:00\n"12 "POT-Creation-Date: 2025-03-27T09:04:03+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.9.0\n" … … 497 497 msgstr "" 498 498 499 #: block/class-thwcfd-block.php:248 499 #. translators: %s Field label. 500 #: block/class-thwcfd-block.php:180 501 msgid "%s (optional)" 502 msgstr "" 503 504 #: block/class-thwcfd-block.php:253 500 505 msgid "The provided %s is not a valid email address." 501 506 msgstr "" 502 507 503 #: block/class-thwcfd-block.php:26 1508 #: block/class-thwcfd-block.php:266 504 509 msgid "The provided %s is not a valid phone number." 505 510 msgstr "" 506 511 507 #: block/class-thwcfd-block.php:27 4512 #: block/class-thwcfd-block.php:279 508 513 msgid "The provided %s is not a valid postcode." 509 514 msgstr "" … … 603 608 msgstr "" 604 609 605 #: public/class-thwcfd-public-checkout.php:4 39610 #: public/class-thwcfd-public-checkout.php:445 606 611 msgid "<strong>%s</strong> is not a valid number." 607 612 msgstr "" 608 613 609 #: public/class-thwcfd-public-checkout.php:44 3614 #: public/class-thwcfd-public-checkout.php:449 610 615 msgid "<strong>%s</strong> is not a valid url." 611 616 msgstr "" -
woo-checkout-field-editor-pro/trunk/public/assets/js/thwcfd-public.min.js
r3253231 r3291675 1 jQuery(document).ready(function($){function field_is_required(field,is_required){is_required?(field.find("label .optional").remove(),field.addClass("validate-required"),field_label_white_space_fix(field),"undefined"!=typeof thwcfd_public_var&&thwcfd_public_var.is_wc_version_grt_9_x?0===field.find('label .required[aria-hidden="true"]').length&&field.find("label").append(' <span class="required" aria-hidden="true">*</span>'):0===field.find("label .required").length&&field.find("label").append(' <abbr class="required" title="'+wc_address_i18n_params.i18n_required_text+'">*</abbr>')):(field.find("label .required").remove(),field.removeClass("validate-required woocommerce-invalid woocommerce-invalid-required-field"),field_label_white_space_fix(field),0===field.find("label .optional").length&&field.find("label").append(' <span class="optional">('+wc_address_i18n_params.i18n_optional_text+")</span>"))}function address_fields_required_validation_fix(){var thisform=$(".woocommerce-checkout"),locale_fields=$.parseJSON(wc_address_i18n_params.locale_fields);locale_fields&&$.each(locale_fields,function(key,value){var fids=value.split(",");$.each(fids,function(index,fid){var field=thisform.find(fid.trim());field.hasClass("thwcfd-required")?field_is_required(field,!0):field.hasClass("thwcfd-optional")&&field_is_required(field,!1)})})}function field_label_white_space_fix(field){var label=field.find("label").html();label&&(label=label.replace(/(?:^(?: )+)|(?:(?: )+$)/g,""),field.find("label").html(label.trim()))}$("select.thwcfd-enhanced-select").selectWoo({allowClear:!0,placeholder:$(this).data("placeholder")}).addClass("enhanced"),$(document.body).bind("country_to_state_changing",function(event,country,wrapper){thwcfd_public_var.is_override_required&&setTimeout(address_fields_required_validation_fix,500)})});1 jQuery(document).ready(function($){function field_is_required(field,is_required){is_required?(field.find("label .optional").remove(),field.addClass("validate-required"),field_label_white_space_fix(field),"undefined"!=typeof thwcfd_public_var&&thwcfd_public_var.is_wc_version_grt_9_x?0===field.find('label .required[aria-hidden="true"]').length&&field.find("label").append(' <span class="required" aria-hidden="true">*</span>'):0===field.find("label .required").length&&field.find("label").append(' <abbr class="required" title="'+wc_address_i18n_params.i18n_required_text+'">*</abbr>')):(field.find("label .required").remove(),field.removeClass("validate-required woocommerce-invalid woocommerce-invalid-required-field"),field_label_white_space_fix(field),0===field.find("label .optional").length&&field.find("label").append(' <span class="optional">('+wc_address_i18n_params.i18n_optional_text+")</span>"))}function address_fields_required_validation_fix(){var thisform=$(".woocommerce-checkout"),locale_fields=$.parseJSON(wc_address_i18n_params.locale_fields);locale_fields&&$.each(locale_fields,function(key,value){var fids=value.split(",");$.each(fids,function(index,fid){var field=thisform.find(fid.trim());field.hasClass("thwcfd-required")?field_is_required(field,!0):field.hasClass("thwcfd-optional")&&field_is_required(field,!1)})})}function address_fields_validation_fix_after_adrs_entered(country){var thisform=$(".woocommerce-checkout"),locale_fields=$.parseJSON(wc_address_i18n_params.locale_fields),locale_json=wc_address_i18n_params.locale.replace(/"/g,'"'),locale=JSON.parse(locale_json),thisLocale=locale[country]||locale.default;locale_fields&&$.each(locale_fields,function(key,value){var fids=value.split(","),field_set=thisLocale[key];$.each(fids,function(index,fid){var field=thisform.find(fid.trim());"object"==typeof field_set&&null!==field_set&&"hidden"in field_set||(field.hasClass("thwcfd-required")?field_is_required(field,!0):field.hasClass("thwcfd-optional")&&field_is_required(field,!1))})})}function field_label_white_space_fix(field){var label=field.find("label").html();label&&(label=label.replace(/(?:^(?: )+)|(?:(?: )+$)/g,""),field.find("label").html(label.trim()))}$("select.thwcfd-enhanced-select").selectWoo({allowClear:!0,placeholder:$(this).data("placeholder")}).addClass("enhanced"),$(document.body).bind("country_to_state_changing",function(event,country,wrapper){thwcfd_public_var.is_override_required&&(thwcfd_public_var.shipping_visible_after_adrs?setTimeout(function(){address_fields_validation_fix_after_adrs_entered(country)},500):setTimeout(address_fields_required_validation_fix,500))})}); -
woo-checkout-field-editor-pro/trunk/public/class-thwcfd-public-checkout.php
r3253231 r3291675 30 30 wp_enqueue_style('thwcfd-checkout-style', THWCFD_ASSETS_URL_PUBLIC . 'css/thwcfd-public' . $suffix . '.css', [],THWCFD_VERSION); 31 31 32 $requires_address = get_option('woocommerce_shipping_cost_requires_address', 'no'); 33 $address_required = ($requires_address === 'yes'); 34 //$shipping_visible_after_adrs = (wc_string_to_bool(get_option('woocommerce_shipping_cost_requires_address', 'no')) && version_compare(THWCFD_Utils::get_wc_version(), '9.8.0', ">=")); 35 $shipping_visible_after_adrs = ( 36 $address_required && 37 version_compare(THWCFD_Utils::get_wc_version(), '9.8.0', ">=") 38 ); 32 39 $wcfd_var = array( 33 40 'is_override_required' => $this->is_override_required_prop(), 34 41 'is_wc_version_grt_9_x' => version_compare(THWCFD_Utils::get_wc_version(), '9.7.0', ">="), 42 'shipping_visible_after_adrs' => $shipping_visible_after_adrs, 35 43 ); 36 44 wp_localize_script('thwcfd-checkout-script', 'thwcfd_public_var', $wcfd_var); … … 77 85 add_filter('woocommerce_form_field_radio', array($this, 'woo_form_field_radio'), 10, 4); 78 86 } 87 //Fix - `Hide shipping costs until an address is entered` options enabled shipping calculation not working from WC 9.8+ version 88 if(version_compare(THWCFD_Utils::get_wc_version(), '9.8.0', ">=")){ 89 add_filter('woocommerce_get_country_locale', array($this, 'modify_address_fields'),9); 90 add_filter('woocommerce_get_country_locale_default', array($this, 'make_address_fields_default'),9); 91 } 79 92 80 93 } … … 178 191 $locale[$country] = $this->prepare_country_locale($locale[$country]); 179 192 } 193 } 194 } 195 return $locale; 196 } 197 198 public function get_posted_value($key){ 199 $value = isset($_POST[$key]) ? stripslashes($_POST[$key]) : ''; 200 201 if(!$value){ 202 $post_data = isset($_POST['post_data']) ? $_POST['post_data'] : ''; 203 204 if($post_data){ 205 parse_str($post_data, $post_data_arr); 206 $value = isset($post_data_arr[$key]) ? stripslashes($post_data_arr[$key]) : ''; 207 } 208 } 209 210 return $value; 211 } 212 213 /** 214 * Modify address fields when `Hide shipping costs until an address is entered` option is enabled 215 * Fix for WC 9.8+ version 216 * @since 2.1.4 217 */ 218 public function modify_address_fields($locales) { 219 if ( 220 ! is_checkout() || 221 ! wc_string_to_bool(get_option('woocommerce_shipping_cost_requires_address', 'no')) || 222 ! $this->is_override_required_prop() 223 ) { 224 return $locales; 225 } 226 227 $use_shipping_address = $this->get_posted_value('ship_to_different_address'); 228 $prefix = $use_shipping_address ? 'shipping_' : 'billing_'; 229 $option_key = $use_shipping_address ? 'wc_fields_shipping' : 'wc_fields_billing'; 230 $field_set = get_option($option_key); 231 232 if ( ! is_array($field_set) ) { 233 return $locales; 234 } 235 236 $fields_to_check = ['address_1', 'postcode', 'city', 'state']; 237 foreach ( $locales as $country => &$locale ) { 238 foreach ( $fields_to_check as $field ) { 239 $field_key = $prefix . $field; 240 if(isset($locale[$field]['hidden']) && $locale[$field]['hidden']){ 241 $locale[$field]['required'] = false; 242 continue; 243 } 244 $locale[$field]['required'] = isset($field_set[$field_key]['required']) 245 ? (bool) $field_set[$field_key]['required'] 246 : true; 247 } 248 } 249 return $locales; 250 } 251 252 /** 253 * Make address fields default when `Hide shipping costs until an address is entered` option is enabled 254 * Fix for WC 9.8+ version 255 * @since 2.1.4 256 */ 257 public function make_address_fields_default($locale) { 258 if ( 259 ! is_checkout() || 260 ! wc_string_to_bool(get_option('woocommerce_shipping_cost_requires_address', 'no')) || 261 ! $this->is_override_required_prop() 262 ) { 263 return $locale; 264 } 265 $use_shipping_address = $this->get_posted_value('ship_to_different_address'); 266 $prefix = $use_shipping_address ? 'shipping_' : 'billing_'; 267 $option_key = $use_shipping_address ? 'wc_fields_shipping' : 'wc_fields_billing'; 268 $fields = get_option($option_key); 269 if ( ! is_array($fields) ) { 270 return $locale; 271 } 272 $address_fields = ['address_1', 'postcode', 'city', 'state']; 273 274 foreach ( $address_fields as $field ) { 275 $address_key = $prefix . $field; 276 if ( isset($fields[$address_key]['required']) ) { 277 $locale[$field]['required'] = (bool) $fields[$address_key]['required']; 180 278 } 181 279 } -
woo-checkout-field-editor-pro/trunk/readme.txt
r3257006 r3291675 4 4 Tags: Checkout Manager, Checkout Field Editor, WooCommerce Checkout, WooCommerce Checkout Field, Custom fields 5 5 Requires at least: 4.9 6 Tested up to: 6. 76 Tested up to: 6.8 7 7 Requires PHP: 5.6 8 Stable tag: 2.1. 38 Stable tag: 2.1.4 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 125 125 3. Date Picker 126 126 4. Label 127 128 🆕 **👉 Note:** The Pro version lets you add an extra checkout field type **Date Picker** when using Block Checkout. 127 129 128 130 = ✅ POSITION SECTIONS AT 14 POSITIONS = … … 336 338 337 339 == Changelog == 340 = 2.1.4 = 341 * Fixed shipping calculation issue when "Hide shipping costs until an address is entered" is enabled (WooCommerce 9.8+ compatibility). 342 * Added WooCommerce 9.8 compatibility. 343 * Added WordPress 6.8 compatibility. 344 338 345 = 2.1.3 = 339 346 * Improved the address fields functionality in the Checkout block.
Note: See TracChangeset
for help on using the changeset viewer.