sameday-courier / magento-2-plugin

Magento 2 plugin for Sameday Courier shipping
4 stars 8 forks source link

address is null on js/view/checkout/shipping/lockers-map-block.js Line 53 #70

Open tuyennn opened 1 month ago

tuyennn commented 1 month ago

While initial checkout as guest, exception throw-ed while address still be null in this scenario.

$(document, 'select[name="region_id"]').on('change', function() {
        let address = quote.shippingAddress();

        rateReg.set(address.getKey(), null);
        rateReg.set(address.getCacheKey(), null);

        quote.shippingAddress(address);
    });

Propose change:

$(document, 'select[name="region_id"]').on('change', function() {
        let address = quote.shippingAddress();
        if(!address) {
            return;
        }
        rateReg.set(address.getKey(), null);
        rateReg.set(address.getCacheKey(), null);

        quote.shippingAddress(address);
    });