Skip to content

Commit e431556

Browse files
committed
mutations add<Product Type>ProductsToCart dosn't check if the cart is active
1 parent e51df41 commit e431556

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

app/code/Magento/QuoteGraphQl/Model/Cart/GetCartForUser.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ public function execute(string $cartHash, ?int $customerId): Quote
8484
)
8585
);
8686
}
87-
return $cart;
87+
88+
try {
89+
return $this->cartRepository->getActiveForCustomer($customerId);
90+
} catch (\Exception $e) {
91+
throw new GraphQlNoSuchEntityException(
92+
__('Current customer does not have an active cart.')
93+
);
94+
}
8895
}
8996
}

0 commit comments

Comments
 (0)