In this episode, we start building the cart page for our app! First, we set up a super basic cart route and controller, then create a simple cart.index
Blade view so we can access /cart
and see our cart in action. Right now, it looks a lot like our dashboard with just a header and a spot for our cart contents.
To make the cart dynamic and interactive, we introduce a Livewire component called Cart
. For now, this just outputs a placeholder, but soon it’ll handle all the cart logic and refreshing when things change (like updating quantities or removing items).
Next up, we get our cart items rendering! We show how to inject the cart interface and loop through the cart contents, outputting each variation (like different sizes or colors of a product) for now. To keep things organized and set up for features like updating quantities, we break each cart item out into its own Livewire component called CartItem
. Each item now lives in its own component, ready for more interactivity in the future.
At the end of the episode, we’ve got a clean cart page that lists all the variations you’ve added—though currently, it only shows the basic variation info. In the next episode, we’ll make it more useful by grabbing and displaying the parent product titles and other details.