Skip to content

Commit

Permalink
fix: Handle errors on placeOrder mutations
Browse files Browse the repository at this point in the history
The PlaceOrder resolver does not necessary return an order, in case of errors. See https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/QuoteGraphQl/Model/Resolver/PlaceOrder.php#L106
  • Loading branch information
pmzandbergen authored Nov 13, 2024
1 parent e40f620 commit 2006128
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Plugin/GraphQlPlaceOrderAddCartId.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ public function __construct(
*/
public function afterResolve(PlaceOrder $placeOrder, array $result): array
{
if (!isset($result['order'])) {
return $result;
}

try {
$cart = $this->quoteHelper->getQuoteByOrderIncrementId($result['order']['order_number']);
$maskedId = $this->quoteIdToMaskedQuoteId->execute($cart->getId());
Expand Down

0 comments on commit 2006128

Please sign in to comment.