Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function processCartItems(Quote $cart, array $items): void
$quantity = (float)$item['quantity'];

if ($quantity <= 0.0) {
$this->cartItemRepository->deleteById((int)$cart->getId(), $itemId);
$cart->removeItem($itemId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After further analysis, your point is valid. The current GraphQL implementation using CartItemRepositoryInterface::deleteById() is inconsistent with the rest of Magento (REST API, Controllers) which all use Quote::removeItem().

But please add a comment explaining the fix.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! I have found a couple more places that could possibly also use this change
https://github.com/search?q=repo%3Amagento%2Fmagento2%20cartItemRepository-%3EdeleteById&type=code

$this->cartItemRepository->deleteById($cartId, $itemId);

$this->cartItemRepository->deleteById($cartId, $itemId);

What should our approach be on that? Updating those files in this PR as well, or creating separate issues and fixing them separately?

} else {
$this->updateCartItem->execute($cart, $itemId, $quantity, $customizableOptions);
}
Expand Down