Storefront api - product seo

Solved
lcberg
New Member
2 0 0

I am querying the Storefront api for products and want to access the seo fields (title and description). In the documentation for the api seo is listed as a possible field for every version since 2021-01. However every time the fields seo.title and seo.description come back nulled. I tried every 2021 version of the api. The other product fields are populated properly and I double checked, that I populated the fields in the shopify admin panel.

lcberg_0-1628584024363.png

This is my graphql query: 

 

{
    productByHandle(handle: "alexandra") {
        handle
        description
        seo {
            title
            description
        }
    }
}

 

This is my response:

 

{
    "data": {
        "productByHandle": {
            "handle": "alexandra",
            "description": "Produktbeschreibung Der Unisex-Canvas-Shopper Alexandra mit großem HAM-Artwork Kontrast-Druck ist multifunktional und für jeden Anlass bereit. Material und Details 100% Baumwolle Pflege nicht waschen nicht bleichen nicht im Trockner trocknen nicht bügeln nicht chemisch reinigen",
            "seo": {
                "title": null,
                "description": null
            }
        }
    }
}

 

 

The graphql doesn't give me a deprecation warning:

lcberg_1-1628584201544.png

 

I already contacted support and they told me the api "behaves the way it should". Is the seo data in my screenshot not the one i am querying? Or what actually happens here?

 

Thank you for your responses!

0 Likes
junichiokamura
Community Manager
Community Manager
1109 257 456

This is an accepted solution.

Hi,  could you check if you input SEO title and description manually on the product admin?

Shopify uses product title and description as SEO data by default, which means no SEO setting data exists.

As I checked my Storefront API Product root search,  all of my products had nulls in SEO, but once I put manual data in SEO, that product returned SEO data in API, so productByHandle should have the same behavior. 

Hope this will work for you.

 

Technical Partner Manager, Japan
lcberg
New Member
2 0 0

That did work thank you.

Still find it strange, but now I know how to work around it.

0 Likes