Skip to content

Commit 019f8dc

Browse files
committed
Prevent updates to child cart items via updateCartItems mutation
1 parent 5525815 commit 019f8dc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

app/code/Magento/QuoteGraphQl/Model/Resolver/UpdateCartItems.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ private function processCartItems(Quote $cart, array $items): void
105105
$itemId = (int)$item['cart_item_id'];
106106
$customizableOptions = $item['customizable_options'] ?? [];
107107

108+
$cartItem = $cart->getItemById($itemId);
109+
if ($cartItem && $cartItem->getParentItemId()) {
110+
throw new GraphQlInputException(__('Child items may not be updated.'));
111+
}
112+
108113
if (count($customizableOptions) === 0 && !isset($item['quantity'])) {
109114
throw new GraphQlInputException(__('Required parameter "quantity" for "cart_items" is missing.'));
110115
}

0 commit comments

Comments
 (0)