Skip to content

Commit

Permalink
Disable pickup location delivery when manually unchecking shipping to…
Browse files Browse the repository at this point in the history
… different address.
  • Loading branch information
dennisnissle committed May 6, 2024
1 parent 349c769 commit df8c202
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions assets/js/static/pickup-locations.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,23 @@ window.germanized.shipments_pickup_locations = window.germanized.shipments_picku

$( document.body ).on( 'updated_checkout', self.afterRefreshCheckout );
$( document ).on( 'change', '#pickup_location_field #pickup_location', self.onSelectPickupLocation );
$( document ).on( 'change', '#ship-to-different-address-checkbox', self.onSelectDifferentShipping );

self.afterRefreshCheckout();
}
},

onSelectDifferentShipping: function() {
var self = germanized.shipments_pickup_locations,
$pickupSelect = self.getPickupLocationSelect();

if ( ! $( this ).is( ':checked' ) ) {
if ( $pickupSelect.val() ) {
$pickupSelect.val( '' ).trigger( 'change' );
}
}
},

maybeInitSelect2: function() {
if ( $().selectWoo ) {
$( 'select#pickup_location:visible, select#pickup_location:visible' ).each( function() {
Expand Down

0 comments on commit df8c202

Please sign in to comment.