I am abit confused on how to utilize this documentation? https://shopify.dev/docs/api/storefront/2023-01/objects/SEO I am aware that I will need to use the graph QL api, but the document is not clear compared to examples provided for other api use.
Hi @Iciren ![]()
Storefront API supports reading the SEO object, and Admin API is required to modify them. Using Collection.SEO as an example:
- SFAPI can query a collection to read the
seofield:
{
collection(id: "gid://shopify/Collection/123") {
seo {
description
title
}
}
}
- to modify the field, we use the
collectionUpdatemutation in Admin API:
mutation ($input: CollectionInput!) {
collectionUpdate(input: $input) {
collection {
seo{
title
description
}
}
}
}
{
"input": {
"id": "gid://shopify/Collection/123",
"seo": {
"title": "foo",
"description": "bar"
}
}
}
Hope that helps!