In this episode, we keep things simple and set up a flat list of shipping options for our checkout flow. Rather than tackling all the complexities of weight- or size-based shipping just yet, we focus on creating a shipping_types
table with basic info: a title (like "UPS Standard") and a fixed price (stored in pence).
We'll walk through creating the model and migration for shipping types, seeding the database with a few straightforward examples, including a free shipping option and a paid one. The episode then shows how to pull these shipping types into our Livewire checkout component, setting them up to display nicely in a dropdown ordered by price, so the cheapest shipping is at the top.
We cover wiring the selected shipping option so it's tracked as the user moves through checkout, including making sure the first (cheapest) shipping option is picked by default. You’ll see a couple of Livewire gotchas, like remembering to make properties public so they sync across requests.
Finally, you'll see how to display the chosen shipping method and its formatted price dynamically on the checkout page, so users see their selection update in real time. Once this is done, we're set up for later, when we’ll add shipping into our total calculation. Super straightforward, but a crucial building block for a great checkout experience!