File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 475
475
};
476
476
// Sync update to the total
477
477
request.onshippingoptionchange = ev => {
478
- const shippingOption = shippingOptions.find(
479
- option => option.id === request.id
480
- );
478
+ // selected shipping option
479
+ const { shippingOption } = request;
481
480
const newTotal = {
482
481
currency: "USD",
483
482
label: "Total due",
484
483
value: calculateNewTotal(shippingOption),
485
484
};
486
- ev.updateWith({ ...details, total: newTotal });
485
+ ev.updateWith({ total: newTotal });
487
486
};
488
487
async function checkShipping(request) {
489
488
try {
492
491
await ensureCanShipTo(json);
493
492
const { shippingOptions, total } = await calculateShipping(json);
494
493
495
- return { ...details, shippingOptions, total };
494
+ return { shippingOptions, total };
496
495
} catch (err) {
497
- return { ...details, error: `Sorry! we can't ship to your address.` };
496
+ return { error: `Sorry! we can't ship to your address.` };
498
497
}
499
498
}
500
499
pre >
You can’t perform that action at this time.
0 commit comments