File tree 3 files changed +14
-5
lines changed
app/code/Magento/QuoteGraphQl
dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest 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
61
61
return $ addressData ;
62
62
}
63
63
64
- $ addressItemsData = [];
65
64
foreach ($ address ->getAllItems () as $ addressItem ) {
66
65
if ($ addressItem instanceof \Magento \Quote \Model \Quote \Item) {
67
66
$ itemId = $ addressItem ->getItemId ();
@@ -70,15 +69,17 @@ public function execute(QuoteAddress $address): array
70
69
}
71
70
$ productData = $ addressItem ->getProduct ()->getData ();
72
71
$ 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 ' ][] = [
74
77
'id ' => $ itemId ,
75
78
'quantity ' => $ addressItem ->getQty (),
76
79
'product ' => $ productData ,
77
80
'model ' => $ addressItem ,
78
81
];
79
82
}
80
- $ addressData ['cart_items ' ] = $ addressItemsData ;
81
-
82
83
return $ addressData ;
83
84
}
84
85
}
Original file line number Diff line number Diff line change @@ -221,7 +221,8 @@ type ShippingCartAddress implements CartAddressInterface {
221
221
selected_shipping_method : SelectedShippingMethod @resolver (class : " \\ Magento\\ QuoteGraphQl\\ Model\\ Resolver\\ ShippingAddress\\ SelectedShippingMethod" )
222
222
customer_notes : String
223
223
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 ]
225
226
}
226
227
227
228
type BillingCartAddress implements CartAddressInterface {
Original file line number Diff line number Diff line change @@ -73,6 +73,9 @@ public function testGetAvailableShippingMethods()
73
73
$ expectedAddressData ,
74
74
$ response ['cart ' ]['shipping_addresses ' ][0 ]['available_shipping_methods ' ][0 ]
75
75
);
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 ' ]);
76
79
}
77
80
78
81
/**
@@ -137,6 +140,10 @@ private function getQuery(string $maskedQuoteId): string
137
140
cart (cart_id: " {$ maskedQuoteId }") {
138
141
shipping_addresses {
139
142
cart_items {
143
+ cart_item_id
144
+ quantity
145
+ }
146
+ cart_items_v2 {
140
147
id
141
148
quantity
142
149
product {
You can’t perform that action at this time.
0 commit comments