Update Checkout Extension Header Icon

Solved

Update Checkout Extension Header Icon

akingMF
Visitor
2 1 0

I'm trying to use a custom image for the checkout header icon:

akingMF_2-1714079853671.png

 

Using the admin api, the docs are saying to target this field:

akingMF_1-1714079525122.png

Here is my mutation:

mutation changeBrandingHeader($checkoutBranding: CheckoutBrandingInput!, $checkoutProfileId: ID!) {
  checkoutBrandingUpsert(checkoutBrandingInput: $checkoutBranding, checkoutProfileId: $checkoutProfileId) {
    checkoutBranding {
        customizations {
            header {
                cartLink {
                    image {
                        url
                    }
                }
            }
        }
    }
    userErrors {
      field
      message
    }
  }
}

Variables:
{
  "checkoutProfileId": "gid://shopify/CheckoutProfile/--------",
  "checkoutBranding": {
    "customizations": {
      "header": {
        "cartLink": {
           "image": {
           }
        }
      }
    }
  }
}

 

However, I am receiving a response saying the field does not exist:

            "message": "Variable $checkoutBranding of type CheckoutBrandingInput! was provided invalid value for customizations.header.cartLink.image.url (Field is not defined on CheckoutBrandingImageInput)"

Changing the contentType to "IMAGE" works just fine, as well as "TEXT" or "ICON", but I can not access the url field for the image. I have tried to set several other fields inside the image object and nothing is working. We are using the 2024-04 api version. 
Accepted Solution (1)

akingMF
Visitor
2 1 0

This is an accepted solution.

I was using the wrong key to set the image. It needs to be "mediaImageId" and the variable is a GID that you need to find for the image:

      "header": {
        "cartLink": {
            "contentType": "IMAGE",
            "image": {
                "mediaImageId": "gid://shopify/MediaImage/23455366643786"
            }
        }
      }

 

View solution in original post

Reply 1 (1)

akingMF
Visitor
2 1 0

This is an accepted solution.

I was using the wrong key to set the image. It needs to be "mediaImageId" and the variable is a GID that you need to find for the image:

      "header": {
        "cartLink": {
            "contentType": "IMAGE",
            "image": {
                "mediaImageId": "gid://shopify/MediaImage/23455366643786"
            }
        }
      }