Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cart clears when logging out #340

Open
Stelikas opened this issue Jun 18, 2022 · 0 comments
Open

Cart clears when logging out #340

Stelikas opened this issue Jun 18, 2022 · 0 comments

Comments

@Stelikas
Copy link

I have created this function inside CartController

private $cart_id;

 public function __construct()
 {
     $this->cart_id = \Cookie::get('cart');
     if ($this->cart_id) {
         
     } else {
         $this->cart_id = uniqid();
         $this->setCartCookie();
     }
 }

 public function setCartCookie()
 {
     if (!Cookie::hasQueued('cart')) {
         Cookie::queue(
             Cookie::make('cart', $this->cart_id, 60 * 24 * 30)
         );
     }
 }

Although when logging out the cart is empty but the cookie still remains the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant