Cart Transformer api failing with "Image Not found"

Description:

Trying to update image on a line item via cart transform api.

What Image:

Image that exists and works on shopify cdn.

https://cdn.shopify.com/s/files/1/0809/9315/7416/files/media_187dda34-9d36-454b-ad75-995ec87eab48.png

Access Scopes:

write_cart_transofrms,write_products

Output Json

{
  "operations": [
    {
      "update": {
        "cartLineId": "gid://shopify/CartLine/e63a162c-40b0-47a2-b29a-7d3f5dbcc07f",
        "title": "This was updated ",
        "image": {
          "url": "https://cdn.shopify.com/s/files/1/0809/9315/7416/files/media_187dda34-9d36-454b-ad75-995ec87eab48.png"
        }
      }
    }
  ]
}

Error Message

[
  "operations[0] (update): [{code: image_not_found, message: Image not found for the shop.}]"
]

Could this be a reason?

https://shopify.dev/docs/api/functions/reference/cart-transform#showing-overrides :

Images that are used for override must first be uploaded to the Shopify CDN and should belong to the store.

Hello Tim

Thank you for helping, I figured out the issue. Image should be uploaded as Media not as file. I was trying initially with type as File. After changing. it to media, it all worked. (even though the file upload is shopify cdn, it fails, you cannot use it part of cart transform api)

1 Like