File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed
app/code/Magento/QuoteGraphQl
dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,6 @@ public function execute(QuoteAddress $address): array
6161 return $ addressData ;
6262 }
6363
64- $ addressItemsData = [];
6564 foreach ($ address ->getAllItems () as $ addressItem ) {
6665 if ($ addressItem instanceof \Magento \Quote \Model \Quote \Item) {
6766 $ itemId = $ addressItem ->getItemId ();
@@ -70,15 +69,17 @@ public function execute(QuoteAddress $address): array
7069 }
7170 $ productData = $ addressItem ->getProduct ()->getData ();
7271 $ productData ['model ' ] = $ addressItem ->getProduct ();
73- $ addressItemsData [] = [
72+ $ addressData ['cart_items ' ][] = [
73+ 'cart_item_id ' => $ itemId ,
74+ 'quantity ' => $ addressItem ->getQty ()
75+ ];
76+ $ addressData ['cart_items_v2 ' ][] = [
7477 'id ' => $ itemId ,
7578 'quantity ' => $ addressItem ->getQty (),
7679 'product ' => $ productData ,
7780 'model ' => $ addressItem ,
7881 ];
7982 }
80- $ addressData ['cart_items ' ] = $ addressItemsData ;
81-
8283 return $ addressData ;
8384 }
8485}
Original file line number Diff line number Diff line change @@ -221,7 +221,8 @@ type ShippingCartAddress implements CartAddressInterface {
221221 selected_shipping_method : SelectedShippingMethod @resolver (class : " \\ Magento\\ QuoteGraphQl\\ Model\\ Resolver\\ ShippingAddress\\ SelectedShippingMethod" )
222222 customer_notes : String
223223 items_weight : Float @deprecated (reason : " This information shoud not be exposed on frontend" )
224- cart_items : [CartItemInterface ]
224+ cart_items : [CartItemQuantity ] @deprecated (reason : " `cart_items_v2` should be used instead" )
225+ cart_items_v2 : [CartItemInterface ]
225226}
226227
227228type BillingCartAddress implements CartAddressInterface {
Original file line number Diff line number Diff line change @@ -73,6 +73,9 @@ public function testGetAvailableShippingMethods()
7373 $ expectedAddressData ,
7474 $ response ['cart ' ]['shipping_addresses ' ][0 ]['available_shipping_methods ' ][0 ]
7575 );
76+ self ::assertCount (1 , $ response ['cart ' ]['shipping_addresses ' ][0 ]['cart_items ' ]);
77+ self ::assertCount (1 , $ response ['cart ' ]['shipping_addresses ' ][0 ]['cart_items_v2 ' ]);
78+ self ::assertEquals ('simple_product ' , $ response ['cart ' ]['shipping_addresses ' ][0 ]['cart_items_v2 ' ][0 ]['product ' ]['sku ' ]);
7679 }
7780
7881 /**
@@ -137,6 +140,10 @@ private function getQuery(string $maskedQuoteId): string
137140 cart (cart_id: " {$ maskedQuoteId }") {
138141 shipping_addresses {
139142 cart_items {
143+ cart_item_id
144+ quantity
145+ }
146+ cart_items_v2 {
140147 id
141148 quantity
142149 product {
You can’t perform that action at this time.
0 commit comments