laravelshoppingcart icon indicating copy to clipboard operation
laravelshoppingcart copied to clipboard

how to get the instance 'default'

Open g1993 opened this issue 5 years ago • 1 comments

hello

I am trying to get the default instance of cart.

my route in web.php: Route::get('empty',function(){ Cart::instance('default')->destroy(); });

I hope you can help me with this thanks in advance

g1993 avatar Oct 25 '20 17:10 g1993

You have two options:

  1. Override default session key using Cart::session('default')->add(...) when adding items to the cart. More info here: https://github.com/darryldecode/laravelshoppingcart#important-note

  2. Change $session_key to "default" on ShoppingCartServiceProvider.php.

In both cases you can access cart contents with Cart::session('default')->getContent().

cleybertandre avatar Jan 27 '21 17:01 cleybertandre