Skip to content

Commit

Permalink
fix(checkout): allow delivery options outside eu
Browse files Browse the repository at this point in the history
  • Loading branch information
joerivanveen committed Jan 18, 2024
1 parent 8b235ab commit 73383d1
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions view/frontend/web/js/model/checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function(
const hasDeliveryOptions = Model.hasDeliveryOptions();
const myParcelMethods = hasDeliveryOptions ? Model.configuration().methods || [] : [];
const cell = document.getElementById('label_method_' + rate.method_code + '_' + rate.carrier_code) || null;

console.warn(Model);
if (!rate.available || !cell) {
return;
}
Expand Down Expand Up @@ -289,24 +289,17 @@ function(
}));
}

function isEuCountry(shippingCountry) {
return EU_COUNTRIES.includes(shippingCountry);
}

function updateHasDeliveryOptions() {
let isAllowed = false;
const shippingCountry = quote.shippingAddress().countryId;

if (isEuCountry(shippingCountry)) {

Model.allowedShippingMethods().forEach(function(carrierCode) {
const rate = Model.findOriginalRateByCarrierCode(carrierCode);
Model.allowedShippingMethods().forEach(function(carrierCode) {
const rate = Model.findOriginalRateByCarrierCode(carrierCode);
if (rate && rate.available) {
isAllowed = true;
}
});

if (rate && rate.available) {
isAllowed = true;
}
});
}
Model.hasDeliveryOptions(isAllowed);
Model.hideShippingMethods();
}
Expand Down

0 comments on commit 73383d1

Please sign in to comment.