Plugin Directory

Changeset 3291675


Ignore:
Timestamp:
05/12/2025 08:51:32 AM (7 months ago)
Author:
ThemeHigh
Message:

Version 2.1.4

Location:
woo-checkout-field-editor-pro/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • woo-checkout-field-editor-pro/trunk/block/class-thwcfd-block.php

    r3253231 r3291675  
    175175                    $field['optionalLabel'] = $field_set[$key]['label']?? $field['optionalLabel'];
    176176                }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'];
    178183                }
    179184                $field['required'] = $field_set[$key]['required'] ?? $field['required'];
  • woo-checkout-field-editor-pro/trunk/checkout-form-designer.php

    r3253231 r3291675  
    44 * Description: Customize WooCommerce checkout fields(Add, Edit, Delete and re-arrange fields).
    55 * Author:      ThemeHigh
    6  * Version:     2.1.3
     6 * Version:     2.1.4
    77 * Author URI:  https://www.themehigh.com
    88 * Plugin URI:  https://www.themehigh.com
     
    1010 * Domain Path: /languages
    1111 * WC requires at least: 3.0.0
    12  * WC tested up to: 9.7
     12 * WC tested up to: 9.8
    1313 */
    1414 
     
    2626
    2727if(is_woocommerce_active()) {
    28     define('THWCFD_VERSION', '2.1.3');
     28    define('THWCFD_VERSION', '2.1.4');
    2929    !defined('THWCFD_BASE_NAME') && define('THWCFD_BASE_NAME', plugin_basename( __FILE__ ));
    3030    !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  
    33msgid ""
    44msgstr ""
    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"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woo-checkout-field-editor-pro\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2025-02-27T11:58:24+00:00\n"
     12"POT-Creation-Date: 2025-03-27T09:04:03+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.9.0\n"
     
    497497msgstr ""
    498498
    499 #: block/class-thwcfd-block.php:248
     499#. translators: %s Field label.
     500#: block/class-thwcfd-block.php:180
     501msgid "%s (optional)"
     502msgstr ""
     503
     504#: block/class-thwcfd-block.php:253
    500505msgid "The provided %s is not a valid email address."
    501506msgstr ""
    502507
    503 #: block/class-thwcfd-block.php:261
     508#: block/class-thwcfd-block.php:266
    504509msgid "The provided %s is not a valid phone number."
    505510msgstr ""
    506511
    507 #: block/class-thwcfd-block.php:274
     512#: block/class-thwcfd-block.php:279
    508513msgid "The provided %s is not a valid postcode."
    509514msgstr ""
     
    603608msgstr ""
    604609
    605 #: public/class-thwcfd-public-checkout.php:439
     610#: public/class-thwcfd-public-checkout.php:445
    606611msgid "<strong>%s</strong> is not a valid number."
    607612msgstr ""
    608613
    609 #: public/class-thwcfd-public-checkout.php:443
     614#: public/class-thwcfd-public-checkout.php:449
    610615msgid "<strong>%s</strong> is not a valid url."
    611616msgstr ""
  • 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('&nbsp;<span class="required" aria-hidden="true">*</span>'):0===field.find("label .required").length&&field.find("label").append('&nbsp;<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('&nbsp;<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(/(?:^(?:&nbsp;)+)|(?:(?:&nbsp;)+$)/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)})});
     1jQuery(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('&nbsp;<span class="required" aria-hidden="true">*</span>'):0===field.find("label .required").length&&field.find("label").append('&nbsp;<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('&nbsp;<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(/&quot;/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(/(?:^(?:&nbsp;)+)|(?:(?:&nbsp;)+$)/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  
    3030            wp_enqueue_style('thwcfd-checkout-style', THWCFD_ASSETS_URL_PUBLIC . 'css/thwcfd-public' . $suffix . '.css', [],THWCFD_VERSION);
    3131
     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            );
    3239            $wcfd_var = array(
    3340                'is_override_required' => $this->is_override_required_prop(),
    3441                '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,
    3543            );
    3644            wp_localize_script('thwcfd-checkout-script', 'thwcfd_public_var', $wcfd_var);
     
    7785            add_filter('woocommerce_form_field_radio', array($this, 'woo_form_field_radio'), 10, 4);
    7886        }
     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        }
    7992       
    8093    }
     
    178191                    $locale[$country] = $this->prepare_country_locale($locale[$country]);
    179192                }
     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'];
    180278            }
    181279        }
  • woo-checkout-field-editor-pro/trunk/readme.txt

    r3257006 r3291675  
    44Tags: Checkout  Manager, Checkout Field Editor, WooCommerce Checkout, WooCommerce Checkout Field, Custom fields
    55Requires at least: 4.9
    6 Tested up to: 6.7
     6Tested up to: 6.8
    77Requires PHP: 5.6
    8 Stable tag: 2.1.3
     8Stable tag: 2.1.4
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    125125    3.  Date Picker
    126126    4.  Label
     127
     128    🆕 **👉 Note:** The Pro version  lets you add an extra checkout field type **Date Picker** when using Block Checkout.
    127129   
    128130= ✅ POSITION SECTIONS AT 14 POSITIONS  =
     
    336338
    337339== 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
    338345= 2.1.3 =
    339346* Improved the address fields functionality in the Checkout block.
Note: See TracChangeset for help on using the changeset viewer.