When re-filling fields on checkout, only change the empty ones.

This commit is contained in:
Mike Jolley 2017-05-15 17:59:22 +01:00
parent 31651e41cb
commit 438e1aeeea
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();
}
}