Merge pull request #15078 from woocommerce/fix/restore-empty-checkout-data-only

When re-filling fields on checkout, only change the empty ones.
This commit is contained in:
Claudio Sanches 2017-05-16 12:39:28 -03:00 committed by GitHub
commit d6e43ddbe1
1 changed files with 2 additions and 2 deletions

View File

@ -331,7 +331,7 @@ jQuery( function( $ ) {
$( '#terms' ).prop( 'checked', true );
}
// Fill in the payment details if possible
// Fill in the payment details if possible without overwriting data if set.
if ( ! $.isEmptyObject( paymentDetails ) ) {
$( '.payment_box input' ).each( function() {
var ID = $( this ).attr( 'id' );
@ -339,7 +339,7 @@ jQuery( function( $ ) {
if ( ID ) {
if ( $.inArray( $( this ).attr( 'type' ), [ 'checkbox', 'radio' ] ) !== -1 ) {
$( this ).prop( 'checked', paymentDetails[ ID ] ).change();
} else {
} else if ( 0 === $( this ).val().length ) {
$( this ).val( paymentDetails[ ID ] ).change();
}
}