diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cbac6da30..10fae83725 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased - Fixed a bug where Edit Product pages would allow duplication for users that didn’t have permission to duplicate the product. ([#3819](https://github.com/craftcms/commerce/issues/3819)) +- Fixed a PHP error that could occur when updating a cart. ([#3842](https://github.com/craftcms/commerce/issues/3842)) - Fixed a PHP error that could occur when adding an invalid address to a cart. ([#3848](https://github.com/craftcms/commerce/issues/3848)) ## 4.7.2 - 2024-12-18 diff --git a/src/controllers/CartController.php b/src/controllers/CartController.php index 7b57940d37..e2e93f0e85 100644 --- a/src/controllers/CartController.php +++ b/src/controllers/CartController.php @@ -138,6 +138,7 @@ public function actionUpdateCart(): ?Response // When we are about to update the cart, we consider it a real cart at this point, and want to actually create it in the DB. if ($this->_cart->id === null) { + // Make sure we have a fully saved cart before attempting any mutations. $this->_cart = $this->_getCart(true); }