Hey team,
I’m trying to fetch the title of a store’s home page using the GraphQL Admin API, but I’m running into issues with the query structure. The title is set by the user in Online Store > Preferences.
I asked the AI dev assistant in the docs, it told me to do this:
query GetStoreSeoData {
shop {
name
title
description
}
}
but I get this error: GraphqlQueryError: Field ‘title’ doesn’t exist on type ‘Shop’
The description works though!
I noticed that title
is not listed as a field in the docs. shop - GraphQL Admin
Any ideas how I can get the title?
I’ve tried a few other options:
const homepageResponse = await admin.graphql(
`query GetStoreSeoData {
shop {
id
name
onlineStore {
name
primaryDomain {
url
}
seo {
title
description
}
}
}
}`,
);
I got this error: Field ‘onlineStore’ doesn’t exist on type ‘Shop’
`query GetSeoData {
shop {
onlineStore {
seo {
title
description
}
}
}
}`,
GraphqlQueryError: Field ‘onlineStore’ doesn’t exist on type ‘Shop’
I tried accessing the data through shop metafields
const seoResponse = await admin.graphql(
`query GetSeoData {
shop {
metafields(first: 10) {
edges {
node {
namespace
key
value
}
}
}
}
}`,
);
The query worked, but the title and meta description were not in the metafields.
I also tried accessing the data through the theme but this did not work.
Any ideas? This seems like a very basic query.