From 962caf204d37ad84ed55c9a8367f391ea6d11070 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Wed, 24 Apr 2013 13:20:23 +0100 Subject: [PATCH] Disable autocomplete for checkout fields which refresh totals - no events get fired on autocomplete. Closes #3022 --- classes/class-wc-countries.php | 119 +++++++++++++++++++-------------- readme.txt | 1 + 2 files changed, 68 insertions(+), 52 deletions(-) diff --git a/classes/class-wc-countries.php b/classes/class-wc-countries.php index 1294b8e5065..1f41fb156a1 100644 --- a/classes/class-wc-countries.php +++ b/classes/class-wc-countries.php @@ -673,58 +673,73 @@ class WC_Countries { */ public function get_default_address_fields() { $fields = array( - 'country' => array( - 'type' => 'country', - 'label' => __( 'Country', 'woocommerce' ), - 'required' => true, - 'class' => array( 'form-row-wide', 'address-field', 'update_totals_on_change' ), - ), - 'first_name' => array( - 'label' => __( 'First Name', 'woocommerce' ), - 'required' => true, - 'class' => array( 'form-row-first' ), - ), - 'last_name' => array( - 'label' => __( 'Last Name', 'woocommerce' ), - 'required' => true, - 'class' => array( 'form-row-last' ), - 'clear' => true - ), - 'company' => array( - 'label' => __( 'Company Name', 'woocommerce' ), - 'class' => array( 'form-row-wide' ), - ), - 'address_1' => array( - 'label' => __( 'Address', 'woocommerce' ), - 'placeholder' => _x( 'Street address', 'placeholder', 'woocommerce' ), - 'required' => true, - 'class' => array( 'form-row-wide', 'address-field' ), - ), - 'address_2' => array( - 'placeholder' => _x( 'Apartment, suite, unit etc. (optional)', 'placeholder', 'woocommerce' ), - 'class' => array( 'form-row-wide', 'address-field' ), - 'required' => false - ), - 'city' => array( - 'label' => __( 'Town / City', 'woocommerce' ), - 'placeholder' => __( 'Town / City', 'woocommerce' ), - 'required' => true, - 'class' => array( 'form-row-wide', 'address-field' ), - ), - 'state' => array( - 'type' => 'state', - 'label' => __( 'State / County', 'woocommerce' ), - 'placeholder' => __( 'State / County', 'woocommerce' ), - 'required' => true, - 'class' => array( 'form-row-first', 'address-field' ) - ), - 'postcode' => array( - 'label' => __( 'Postcode / Zip', 'woocommerce' ), - 'placeholder' => __( 'Postcode / Zip', 'woocommerce' ), - 'required' => true, - 'class' => array( 'form-row-last', 'address-field' ), - 'clear' => true - ), + 'country' => array( + 'type' => 'country', + 'label' => __( 'Country', 'woocommerce' ), + 'required' => true, + 'class' => array( 'form-row-wide', 'address-field', 'update_totals_on_change' ), + ), + 'first_name' => array( + 'label' => __( 'First Name', 'woocommerce' ), + 'required' => true, + 'class' => array( 'form-row-first' ), + ), + 'last_name' => array( + 'label' => __( 'Last Name', 'woocommerce' ), + 'required' => true, + 'class' => array( 'form-row-last' ), + 'clear' => true + ), + 'company' => array( + 'label' => __( 'Company Name', 'woocommerce' ), + 'class' => array( 'form-row-wide' ), + ), + 'address_1' => array( + 'label' => __( 'Address', 'woocommerce' ), + 'placeholder' => _x( 'Street address', 'placeholder', 'woocommerce' ), + 'required' => true, + 'class' => array( 'form-row-wide', 'address-field' ), + 'custom_attributes' => array( + 'autocomplete' => 'no' + ) + ), + 'address_2' => array( + 'placeholder' => _x( 'Apartment, suite, unit etc. (optional)', 'placeholder', 'woocommerce' ), + 'class' => array( 'form-row-wide', 'address-field' ), + 'required' => false, + 'custom_attributes' => array( + 'autocomplete' => 'no' + ) + ), + 'city' => array( + 'label' => __( 'Town / City', 'woocommerce' ), + 'placeholder' => __( 'Town / City', 'woocommerce' ), + 'required' => true, + 'class' => array( 'form-row-wide', 'address-field' ), + 'custom_attributes' => array( + 'autocomplete' => 'no' + ) + ), + 'state' => array( + 'type' => 'state', + 'label' => __( 'State / County', 'woocommerce' ), + 'placeholder' => __( 'State / County', 'woocommerce' ), + 'required' => true, + 'class' => array( 'form-row-first', 'address-field' ), + 'custom_attributes' => array( + 'autocomplete' => 'no' + ) + ), + 'postcode' => array( + 'label' => __( 'Postcode / Zip', 'woocommerce' ), + 'placeholder' => __( 'Postcode / Zip', 'woocommerce' ), + 'required' => true, + 'class' => array( 'form-row-last', 'address-field' ), + 'clear' => true, + 'custom_attributes' => array( + 'autocomplete' => 'no' + ) + ), ); return apply_filters( 'woocommerce_default_address_fields', $fields ); diff --git a/readme.txt b/readme.txt index 95043268d7b..67816fcda6d 100644 --- a/readme.txt +++ b/readme.txt @@ -167,6 +167,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc = X = * Tweak - Notices during checkout for admin users if the checkout is mis-configured. +* Fix - Disable autocomplete for checkout fields which refresh totals - no events get fired on autocomplete. * Fix - Clear rating transients when editing comments. * Localization - Netherlands, Hungarian, Taiwan, Italian, Spanish updates. * Other minor fixes and localisation updates.