Skip to content

Commit

Permalink
Fixed #3206
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeholder committed Jul 3, 2023
1 parent bc39725 commit 4b315f6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Fixed a bug where address changes weren’t being synced to carts using them as a source. ([#3178](https://github.com/craftcms/commerce/issues/3178))
- Added `craft\commerce\services\Orders::afterSaveAddressHandler()`.
- Added `craft\commerce\elements\Order::$orderCompletedEmail`. ([#3138](https://github.com/craftcms/commerce/issues/3138))
- Added the `commerce/cart/forget-cart` action. ([#3206](https://github.com/craftcms/commerce/issues/3206))

## 4.2.11 - 2023-06-05

Expand Down
14 changes: 14 additions & 0 deletions src/controllers/CartController.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,20 @@ public function actionUpdateCart(): ?Response
return $this->_returnCart();
}

/**
* @return Response|null
* @throws BadRequestHttpException
* @throws InvalidConfigException
* @since 4.3
*/
public function actionForgetCart(): ?Response
{
$this->requirePostRequest();
Plugin::getInstance()->getCarts()->forgetCart();
$this->setSuccessFlash(Craft::t('commerce', 'Cart forgotten.'));
return $this->redirectToPostedUrl();
}

/**
* @throws BadRequestHttpException
* @throws Exception
Expand Down

0 comments on commit 4b315f6

Please sign in to comment.