Skip to content

Commit

Permalink
Merge pull request #3091 from craftcms/fix-forget-cart
Browse files Browse the repository at this point in the history
Fix broken cookie removal
  • Loading branch information
nfourtythree authored Feb 17, 2023
2 parents c90e356 + c4dded4 commit a35f1d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- Fixed a PHP error that could occur when processing a payment. ([#3092](https://github.com/craftcms/commerce/issues/3092))
- Fixed a bug that could occur when forgetting a cart. ([#3091](https://github.com/craftcms/commerce/pull/3091))

## 4.2.5.1 - 2023-02-02

Expand Down
6 changes: 5 additions & 1 deletion src/services/Carts.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,11 @@ public function forgetCart(): void
$this->_cart = null;
$this->_cartNumber = null;
if (!Craft::$app->getRequest()->getIsConsoleRequest()) {
Craft::$app->getResponse()->getCookies()->remove($this->cartCookie['name'], true);
$cookie = Craft::createObject(array_merge($this->cartCookie, [
'class' => Cookie::class,
]));

Craft::$app->getResponse()->getCookies()->remove($cookie, true);
}
}

Expand Down

0 comments on commit a35f1d7

Please sign in to comment.