diff --git a/app/code/Magento/DownloadableGraphQl/Model/Cart/BuyRequest/DownloadableLinksDataProvider.php b/app/code/Magento/DownloadableGraphQl/Model/Cart/BuyRequest/DownloadableLinksDataProvider.php index 18f883b61516..5f159971e4a1 100644 --- a/app/code/Magento/DownloadableGraphQl/Model/Cart/BuyRequest/DownloadableLinksDataProvider.php +++ b/app/code/Magento/DownloadableGraphQl/Model/Cart/BuyRequest/DownloadableLinksDataProvider.php @@ -40,12 +40,7 @@ public function execute(array $cartItemData): array if (isset($cartItemData['data']) && isset($cartItemData['data']['sku'])) { $sku = $cartItemData['data']['sku']; - - try { - $product = $this->productRepository->get($sku); - } catch (NoSuchEntityException $e) { - throw new GraphQlNoSuchEntityException(__('Could not find specified product.')); - } + $product = $this->productRepository->get($sku); if ($product->getLinksPurchasedSeparately() && isset($cartItemData['downloadable_product_links'])) { $downloadableLinks = $cartItemData['downloadable_product_links']; diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php index 39b69f86cbe1..b1858e843bf0 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php @@ -265,7 +265,8 @@ public function testAddNonExistentConfigurableProductVariationToCart() $this->expectException(\Exception::class); $this->expectExceptionMessage( - 'Could not add the product with SKU configurable to the shopping cart: Could not find specified product.' + 'Could not add the product with SKU configurable to the shopping cart: The product that was requested ' . + 'doesn\'t exist. Verify the product and try again.' ); $this->graphQlMutation($query);