Update checkout.js

This commit is contained in:
Andrew Benbow 2019-09-30 10:22:08 +01:00 committed by GitHub
parent 436ee5de3a
commit f8b268d3a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -356,6 +356,8 @@ jQuery( function( $ ) {
}
}
});
// console.log(paymentDetails);
// Always update the fragments
if ( data && data.fragments ) {
@ -374,10 +376,11 @@ jQuery( function( $ ) {
if ( ! $.isEmptyObject( paymentDetails ) ) {
$( '.payment_box :input' ).each( function() {
var ID = $( this ).attr( 'id' );
if ( ID ) {
if ( $.inArray( $( this ).attr( 'type' ), [ 'checkbox', 'radio' ] ) !== -1 ) {
$( 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 ) {
$( this ).val( paymentDetails[ ID ] ).change();
}