Skip to content

Commit f59324e

Browse files
committed
ACP2E-172: Error adding configurable product to cart using GraphQL directly after storeview is changed
1 parent 5d1303a commit f59324e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,29 @@ public function testAddConfigurableProductWithImageToCartParentImage(): void
570570
self::assertEquals($sku, $variant['sku']);
571571
}
572572

573+
/**
574+
* @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
575+
* @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
576+
* @magentoApiDataFixture Magento/Store/_files/second_store.php
577+
*/
578+
public function testAddMoreProductsFromAnotherStore()
579+
{
580+
$parentSku = 'configurable';
581+
$sku = 'simple_20';
582+
$quantity = 400; // the number should be greater than the available qty / 3
583+
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1');
584+
$query = $this->getQuery($maskedQuoteId, $parentSku, $sku, $quantity);
585+
586+
$headerMap = ['Store' => 'default'];
587+
$this->graphQlMutation($query, [], '', $headerMap);
588+
$headerMap = ['Store' => 'fixture_second_store'];
589+
$response = $this->graphQlMutation($query, [], '', $headerMap);
590+
self::assertEquals($maskedQuoteId, $response['addConfigurableProductsToCart']['cart']['id']);
591+
$cartItem = current($response['addConfigurableProductsToCart']['cart']['items']);
592+
self::assertEquals($parentSku, $cartItem['product']['sku']);
593+
self::assertEquals($quantity * 2, $cartItem['quantity']);
594+
}
595+
573596
/**
574597
* @param string $maskedQuoteId
575598
* @param string $parentSku
@@ -594,6 +617,7 @@ private function getQuery(string $maskedQuoteId, string $parentSku, string $sku,
594617
}
595618
) {
596619
cart {
620+
id
597621
items {
598622
id
599623
quantity

0 commit comments

Comments
 (0)