Skip to content

Commit f955dce

Browse files
authored
Merge pull request #26 from magento-arcticfoxes/B2B-1026
B2B-1026: Purchase Order final checkout page is incompatible with msi
2 parents 40bbb2c + 1404238 commit f955dce

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

InventoryInStorePickupShipping/Model/IsInStorePickupDeliveryAvailableForCart.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,9 @@ private function getDefaultCountry(): ?string
120120
*/
121121
private function getEstimateAddress(CartInterface $cart): EstimateAddressInterface
122122
{
123+
$shippingAssignments = $cart->getExtensionAttributes()->getShippingAssignments();
123124
/** @var ShippingAssignmentInterface|null $assignment */
124-
$assignment = current($cart->getExtensionAttributes()->getShippingAssignments());
125+
$assignment = $shippingAssignments ? current($shippingAssignments) : null;
125126
$data = ['country_id' => $this->getDefaultCountry()];
126127
if ($assignment) {
127128
$shippingAddress = $assignment->getShipping()->getAddress();

InventoryInStorePickupShipping/Test/Integration/IsInStorePickupDeliveryAvailableForCartTest.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,35 @@ public function testIsAvailableWithoutProductsIntersection()
105105
$this->assertFalse($this->isInStorePickupAvailable->execute((int)$cart->getId()));
106106
}
107107

108+
/**
109+
* @magentoDataFixture Magento_InventoryApi::Test/_files/products.php
110+
* @magentoDataFixture Magento_InventoryApi::Test/_files/sources.php
111+
* @magentoDataFixture Magento_InventoryInStorePickupApi::Test/_files/source_addresses.php
112+
* @magentoDataFixture Magento_InventoryInStorePickupApi::Test/_files/source_pickup_location_attributes.php
113+
* @magentoDataFixture Magento_InventoryApi::Test/_files/stocks.php
114+
* @magentoDataFixture Magento_InventoryApi::Test/_files/stock_source_links.php
115+
* @magentoDataFixture Magento_InventorySalesApi::Test/_files/websites_with_stores.php
116+
* @magentoDataFixture Magento_InventorySalesApi::Test/_files/stock_website_sales_channels.php
117+
* @magentoDataFixture Magento_InventoryApi::Test/_files/source_items_eu_stock_only.php
118+
* @magentoDataFixture Magento_InventoryIndexer::Test/_files/reindex_inventory.php
119+
* @magentoDataFixture Magento_InventoryInStorePickupSalesApi::Test/_files/create_in_store_pickup_quote_on_eu_website_guest.php
120+
*
121+
* @magentoConfigFixture store_for_eu_website_store carriers/instore/active 1
122+
*
123+
* @magentoDbIsolation disabled
124+
*/
125+
public function testIsAvailableWithoutProductsIntersectionEmptyShippingAssignments()
126+
{
127+
$searchCriteria = $this->searchCriteriaBuilder
128+
->addFilter('reserved_order_id', 'in_store_pickup_test_order')
129+
->create();
130+
/** @var CartInterface $cart */
131+
$cart = current($this->cartRepository->getList($searchCriteria)->getItems());
132+
$cart->getExtensionAttributes()->setShippingAssignments([]);
133+
$this->cartRepository->save($cart);
134+
$this->assertFalse($this->isInStorePickupAvailable->execute((int)$cart->getId()));
135+
}
136+
108137
/**
109138
* @magentoDataFixture Magento_InventoryApi::Test/_files/products.php
110139
* @magentoDataFixture Magento_InventoryApi::Test/_files/sources.php

0 commit comments

Comments
 (0)