Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MC-26683: Removed get errors of cart allowing to add product to cart #27015

Merged
merged 8 commits into from
Mar 19, 2020
13 changes: 1 addition & 12 deletions app/code/Magento/QuoteGraphQl/Model/Cart/AddProductsToCart.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
namespace Magento\QuoteGraphQl\Model\Cart;

use Magento\Framework\GraphQl\Exception\GraphQlInputException;
use Magento\Framework\Message\MessageInterface;
use Magento\Quote\Api\CartRepositoryInterface;
use Magento\Quote\Model\Quote;

/**
* Add products to cart
* Adding products to cart using GraphQL
*/
class AddProductsToCart
{
Expand Down Expand Up @@ -54,16 +53,6 @@ public function execute(Quote $cart, array $cartItems): void
$this->addProductToCart->execute($cart, $cartItemData);
}

if ($cart->getData('has_error')) {
$e = new GraphQlInputException(__('Shopping cart errors'));
$errors = $cart->getErrors();
foreach ($errors as $error) {
/** @var MessageInterface $error */
$e->addError(new GraphQlInputException(__($error->getText())));
}
throw $e;
}

$this->cartRepository->save($cart);
}
}