Merge pull request #24720 from ChromeOrange/master
Allow select fields in credit card form to maintain value when the checkout form refreshes
This commit is contained in:
commit
dec4a381fe
|
@ -356,7 +356,7 @@ jQuery( function( $ ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Always update the fragments
|
// Always update the fragments
|
||||||
if ( data && data.fragments ) {
|
if ( data && data.fragments ) {
|
||||||
$.each( data.fragments, function ( key, value ) {
|
$.each( data.fragments, function ( key, value ) {
|
||||||
|
@ -374,10 +374,11 @@ jQuery( function( $ ) {
|
||||||
if ( ! $.isEmptyObject( paymentDetails ) ) {
|
if ( ! $.isEmptyObject( paymentDetails ) ) {
|
||||||
$( '.payment_box :input' ).each( function() {
|
$( '.payment_box :input' ).each( function() {
|
||||||
var ID = $( this ).attr( 'id' );
|
var ID = $( this ).attr( 'id' );
|
||||||
|
|
||||||
if ( ID ) {
|
if ( ID ) {
|
||||||
if ( $.inArray( $( this ).attr( 'type' ), [ 'checkbox', 'radio' ] ) !== -1 ) {
|
if ( $.inArray( $( this ).attr( 'type' ), [ 'checkbox', 'radio' ] ) !== -1 ) {
|
||||||
$( this ).prop( 'checked', paymentDetails[ ID ] ).change();
|
$( this ).prop( 'checked', paymentDetails[ ID ] ).change();
|
||||||
|
} else if ( $.inArray( $( this ).attr( 'type' ), [ 'select' ] ) !== -1 ) {
|
||||||
|
$( this ).val( paymentDetails[ ID ] ).change();
|
||||||
} else if ( null !== $( this ).val() && 0 === $( this ).val().length ) {
|
} else if ( null !== $( this ).val() && 0 === $( this ).val().length ) {
|
||||||
$( this ).val( paymentDetails[ ID ] ).change();
|
$( this ).val( paymentDetails[ ID ] ).change();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue