Answer the question
In order to leave comments, you need to log in
How to properly display items in the shopping cart?
Id and quantity of goods are stored in the session. Getting cart data from session, here is my cart data array
array:3 [▼
60 => array:2 [▼
"item_id" => "60"
"quantity" => 1
]
3 => array:2 [▼
"item_id" => "3"
"quantity" => 1
]
72 => array:2 [▼
"item_id" => "72"
"quantity" => 3
]
]
$products = Product::find([60, 3, 72]);
Answer the question
In order to leave comments, you need to log in
Well, yes, that's about it. When you pull the cart, pull all the products by id, convert to a collection and then go through the cart and add the "product" key with the corresponding product you pulled earlier.
Further with this, either in the view, or to the front. Sobsno everything.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question