Skip to content

Commit

Permalink
Added support for checkboxes within address-i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
noknokcody committed Nov 9, 2021
1 parent a7b1cea commit 54543da
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion plugins/woocommerce/assets/js/frontend/address-i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,15 @@ jQuery( function( $ ) {
// Hidden fields.
if ( 'state' !== key ) {
if ( typeof fieldLocale.hidden !== 'undefined' && true === fieldLocale.hidden ) {
field.hide().find( ':input' ).val( '' );

// Support for checkboxes
if( field.find( ':input' ).attr( 'type' ) == 'checkbox' ) {
field.hide().find( ':input' ).prop( 'checked', false );
}
else {
field.hide().find( ':input' ).val( '' );
}

} else {
field.show();
}
Expand Down

0 comments on commit 54543da

Please sign in to comment.