Blog images and metafields not returned via Storefront API

Blog images and metafields not returned via Storefront API

WillMendelsohn
Shopify Partner
2 0 1

Hi Shopify Community.

I was hoping someone could help me with an issue I'm having.

I have a blog post configured in the admin.  It's set as visible, and has an image associated with it, but when I request that image via the Storefront GraphQL API, it returns null.

I've also tried putting the image in a metafield, which I've enabled to be visible to the storefront API, but that also returns null.

{
  blogByHandle(handle: "stories") {
    articleByHandle(handle:"conversation-with-cai-yujie") {
			title
      image {
        url
      }
      metafield(namespace:"custom", key: "test") {
        value
      }
    }
  }
}

Response:

{
  "data": {
    "blogByHandle": {
      "articleByHandle": {
        "title": "Conversation with: Cai Yujie",
        "image": null,
        "metafield": null
      }
    }
  }
}

I've checked the following:

  • Blog post is marked as visible
  • Blog post image is correctly set and visible in the admin
  • Metafield namespace and key match what I've set in admin
  • Metafield is configured to be visible to the storefront

Does anyone have any ideas what I can try next?

 

 

 

 

 

Replies 2 (2)

flareAI
Shopify Partner
2405 224 549

Hello @WillMendelsohn,


I am Gina from flareAI app - free sales machine, and I am here to provide assistance.


It's possible that the image you are trying to retrieve via the Storefront GraphQL API is not in the correct format or size for the API to recognize it.


Here are some troubleshooting steps you can take to identify the issue:


1. Check the image format
Ensure that the image format is supported by Shopify. Refer to Shopify guide on supported image formats and if your image is in a different format, convert it to one of the supported formats.

2. Check the image size
Ensure that the image size is within the supported range. Shopify recommends using images that are at least 2048 x 2048 pixels in size. If your image is smaller than this, try resizing it to a larger size.

3. Check the image URL
Double-check the image URL to ensure that it is correct and matches the URL of the image in the admin. If the URL is incorrect, update it in the admin and try again.

4. Check the metafield value
If you are using a metafield to store the image, ensure that the value of the metafield is correct and matches the URL of the image. If the value is incorrect, update it in the admin and try again.


Hope this helps


Gina

flareAI : Get Sales from Google Search, on Autopilot
$10+ billion in eCommerce on Google Search, every day. Find out how much you are missing
WillMendelsohn
Shopify Partner
2 0 1

Hi Gina from FlareAI

I've already checked the things you mentioned

Unfortunately, Shopify's support is never very useful when it comes to technical or API issues, as they don't have a line to the tech department.  They usually recommend people post on the community forum instead, which I did.

Did you generate this response using ChatGPT?  Shame on you!