Hi All,
I have a small problem with my graphql query hitting the customer-account api from within a customer ui extension. I am trying to get some customer metafields along with some other customer information and I keep getting a null back instead.
Here is my query:
const getCustomerQuery = {
query: `query{
customer{
id
lastName
firstName
metafields(identifiers:[{key:"mandate_accepted",namespace:"abilita"},{namespace:"abilita",key:"mandate_info"},{namespace:"abilita",key:"iban"}]){
value
key
}
}
}`
}
I get the following back:
{
"data": {
"customer": {
"id": "gid://shopify/Customer/8415572001044",
"lastName": "Gilbert",
"firstName": "Gary",
"metafields": [
null,
null,
null
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 2,
"actualQueryCost": 2,
"throttleStatus": {
"maximumAvailable": 7500.0,
"currentlyAvailable": 7498,
"restoreRate": 100.0
}
}
}
}
Now when I use graphiql from the terminal (same access scopes as the app) and reformat the query for graphiql
query{
customer(id:"gid://shopify/Customer/8415572001044"){
firstName
id
lastName
metafields(first:3 namespace:"abilita"){
nodes{
key
value
type
}
}
}
}
I get the expected results
{
"data": {
"customer": {
"firstName": "Gary",
"id": "gid://shopify/Customer/8415572001044",
"lastName": "Gilbert",
"metafields": {
"nodes": [
{
"key": "mandate_accepted",
"value": "false",
"type": "boolean"
},
{
"key": "mandate_info",
"value": "{}",
"type": "json"
},
{
"key": "iban",
"value": "12345",
"type": "single_line_text_field"
}
]
}
}
},
Anybody know or have an idea why Im getting back nulls? @Liam-Shopify got an idea?
Cheers and thanks!
Gary