Skip to content

Commit b7ec605

Browse files
committed
Potential fix for 4279
1 parent 94bece0 commit b7ec605

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Unreleased
44

5+
- Fixed a bug where `forgetCart()` was ineffective when `getCart()` was called later in the same request. ([#4279](https://github.com/craftcms/commerce/issues/4279))
56
- Fixed a bug where variants weren’t being saved for product types with a Variant SKU Format that could cause duplicate SKUs. ([#4249](https://github.com/craftcms/commerce/issues/4249))
67
- Fixed a PHP error that occurred when marking an inventory transfer as pending. ([#4267](https://github.com/craftcms/commerce/issues/4267))
78
- Improved the performance of migrations when upgrading to 5.x. ([#4277](https://github.com/craftcms/commerce/issues/4277))

src/services/Carts.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,11 @@ protected function loadCookie(): void
505505
$this->cartCookie['name'] = md5(sprintf('Craft.%s.%s.%s', self::class, Craft::$app->id, $currentStore->handle)) . '_commerce_cart';
506506
}
507507

508+
// Don't restore from cookie if the cart was explicitly forgotten this request.
509+
if ($this->_cartNumber === false) {
510+
return;
511+
}
512+
508513
$request = Craft::$app->getRequest();
509514
if (!$request->getIsConsoleRequest()) {
510515
$this->cartCookie = Craft::cookieConfig($this->cartCookie);

0 commit comments

Comments
 (0)