Skip to content

Commit 56bdbc2

Browse files
author
Prabhu Ram
committed
Merge remote-tracking branch 'origin/MC-34841-free-payment' into MC-36897
2 parents e24f416 + c94a2f8 commit 56bdbc2

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77

88
namespace Magento\QuoteGraphQl\Model\Cart;
99

10+
use Magento\Framework\App\ObjectManager;
1011
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
1112
use Magento\GraphQl\Model\Query\ContextInterface;
1213
use Magento\Quote\Api\Data\CartInterface;
14+
use Magento\Quote\Model\QuoteRepository;
1315

1416
/**
1517
* Set single shipping address for a specified shopping cart
@@ -26,16 +28,25 @@ class SetShippingAddressesOnCart implements SetShippingAddressesOnCartInterface
2628
*/
2729
private $getShippingAddress;
2830

31+
/**
32+
* @var QuoteRepository
33+
*/
34+
private $quoteRepository;
35+
2936
/**
3037
* @param AssignShippingAddressToCart $assignShippingAddressToCart
3138
* @param GetShippingAddress $getShippingAddress
39+
* @param QuoteRepository|null $quoteRepository
3240
*/
3341
public function __construct(
3442
AssignShippingAddressToCart $assignShippingAddressToCart,
35-
GetShippingAddress $getShippingAddress
43+
GetShippingAddress $getShippingAddress,
44+
QuoteRepository $quoteRepository = null
3645
) {
3746
$this->assignShippingAddressToCart = $assignShippingAddressToCart;
3847
$this->getShippingAddress = $getShippingAddress;
48+
$this->quoteRepository = $quoteRepository
49+
?? ObjectManager::getInstance()->get(QuoteRepository::class);
3950
}
4051

4152
/**
@@ -70,5 +81,7 @@ public function execute(ContextInterface $context, CartInterface $cart, array $s
7081
throw $e;
7182
}
7283
$this->assignShippingAddressToCart->execute($cart, $shippingAddress);
84+
// trigger quote re-evaluation after address change
85+
$this->quoteRepository->save($cart);
7386
}
7487
}

0 commit comments

Comments
 (0)