Call ship-to-different-address change handler manually in lieu of event trigger

Avoids unnecessary update_checkout call on initialization.
This commit is contained in:
Paul Dechov 2019-07-29 22:39:19 -04:00
parent 4a94037c52
commit 264556be91
1 changed files with 6 additions and 5 deletions

View File

@ -50,7 +50,7 @@ jQuery( function( $ ) {
this.$checkout_form.on( 'change', '#ship-to-different-address input', this.ship_to_different_address );
// Trigger events
this.$checkout_form.find( '#ship-to-different-address input' ).change();
this.ship_to_different_address();
this.init_payment_methods();
// Update on page load
@ -183,10 +183,11 @@ jQuery( function( $ ) {
wc_checkout_form.trigger_update_checkout();
}
},
ship_to_different_address: function() {
$( 'div.shipping_address' ).hide();
if ( $( this ).is( ':checked' ) ) {
$( 'div.shipping_address' ).slideDown();
ship_to_different_address: function( e ) {
if ( $( '#ship-to-different-address input' ).is( ':checked' ) ) {
$( 'div.shipping_address' ).slideDown( e ? null : 0 );
} else {
$( 'div.shipping_address' ).slideUp( e ? null : 0 );
}
},
reset_update_checkout_timer: function() {