Skip to content

Commit aa25b61

Browse files
committed
ACP2E-2897: [CLOUD] graphql addProductsToCart api issue with custom option
1 parent a225939 commit aa25b61

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app/code/Magento/Quote/Model/Cart/AddProductsToCart.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ private function addItemToCart(Quote $cart, Data\CartItem $cartItem, int $cartIt
157157
$cartItemPosition
158158
);
159159
} else {
160-
$product = $this->productReader->getProductBySku($sku);
160+
$productBySku = $this->productReader->getProductBySku($sku);
161+
$product = isset($productBySku) ? clone $productBySku : null;
161162
if (!$product || !$product->isSaleable() || !$product->isAvailable()) {
162163
$errors[] = $this->error->create(
163164
__('Could not find a product with SKU "%sku"', ['sku' => $sku])->render(),

0 commit comments

Comments
 (0)