Skip to content

Commit 0d2ab3a

Browse files
committed
editorial: fix bad example
1 parent b336891 commit 0d2ab3a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

index.html

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -475,15 +475,14 @@

475475
};
476476
// Sync update to the total
477477
request.onshippingoptionchange = ev => {
478-
const shippingOption = shippingOptions.find(
479-
option => option.id === request.id
480-
);
478+
// selected shipping option
479+
const { shippingOption } = request;
481480
const newTotal = {
482481
currency: "USD",
483482
label: "Total due",
484483
value: calculateNewTotal(shippingOption),
485484
};
486-
ev.updateWith({ ...details, total: newTotal });
485+
ev.updateWith({ total: newTotal });
487486
};
488487
async function checkShipping(request) {
489488
try {
@@ -492,9 +491,9 @@

492491
await ensureCanShipTo(json);
493492
const { shippingOptions, total } = await calculateShipping(json);
494493

495-
return { ...details, shippingOptions, total };
494+
return { shippingOptions, total };
496495
} 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.` };
498497
}
499498
}
500499
pre>

0 commit comments

Comments
 (0)