I am trying to load in graphql product details. I am only managing to get the details of one product $json['Transaction']['OrderItems'][0] but I would like to get the values for all the products which are in $json['Transaction']['OrderItems']. In resolver I have:
return [
'cart' => [
'products' => [
'sku' => $json['Transaction']['OrderItems'][0]['ItemCode'],
'quantity' => $json['Transaction']['OrderItems'][0]['ItemQuantity'],
'price' => $json['Transaction']['OrderItems'][0]['ItemQuantity']
],
]
in schema.graphqls I have:
type AddProductsToCartOutput {
products: ITEMS
}
type ITEMS {
sku: String!
quantity: Float!
price: Float!
}
in the request:
cart {
products {
sku
quantity
price
}
}
and in the output I am getting:
"cart": {
"products": {
"sku": "33150220000",
"quantity": 5,
"price": 5
},
}
But I need to show all the items!