JackieDo / Laravel-Cart

A package used to create and manage carts (such as shopping, recently viewed, compared items...) in Laravel application.
https://jackiedo.github.io/Laravel-Cart
MIT License
160 stars 20 forks source link

When calling a cart from another controller, an empty basket comes out #35

Closed shohrukhsultanov closed 2 years ago

shohrukhsultanov commented 2 years ago

When calling a cart from another controller, an empty basket comes out (most likely a new one). Created a cart like this $cart->newInstance('shopping-cart')->useForCommercial(true)->useBuiltinTax(true); Now I'm trying to get this cart in the checkout controller like $cart->name('shopping-cart') but I'm getting an empty cart. How to be in such a situation? Help me please.

akunbeben-dev commented 2 years ago

I also got the same issue, how do you deal with it? is it solved?

From the docs

Using the name() method is like having a person using two baskets in a supermarket.

In this case, I'm using the default cart name, How can I retrieve the last cart and its items? instead of creating new instance @JackieDo