Checkout create error

AI-generated summary

Main issue: A sales channel app creating checkouts via the GraphQL checkoutCreate mutation intermittently returned checkoutUserErrors with code INVALID for input.lineItems[0].variantId (“Variant is invalid”). Checkout via the Shopify online store succeeded for the same product.

Key context: The product variant exists and “Continue selling when out of stock” is enabled, but that setting does not affect channel availability. In Shopify, variants must be published/made available to the specific sales channel (e.g., custom storefront) to be used in checkoutCreate.

Cause identified: The variant was not available on the sales channel because another app removed the product’s sales channel assignments.

Resolution: Re-publishing/adding the product/variant back to the relevant sales channel fixed the error.

Next steps (if issue recurs):

  • Verify variant availability on the target sales channel in the Shopify admin.
  • If the error persists despite correct publishing, capture and share the X-Request-ID from the response headers for deeper investigation.

Status: Resolved; no outstanding questions.

Hi!
I have sales channel app, which has feature or creating checkouts.

We doing this via GraphQL mutation and it’s ok :

mutation {
      checkoutCreate(input: {
        lineItems: [{variantId: "BASE64_VARIANT_ID", quantity: 1},]
      }) {
        checkout {
           id
           webUrl
        }
        checkoutUserErrors {
          code
          field
          message
        }
      }
    }

But it seems that sometimes it working strange - on some shops we receive error

[{'code': 'INVALID', 'field': ['input', 'lineItems', '0', 'variantId'], 'message': 'Variant is invalid'}]

And it’s okay, but when I try to put this items in the cart and make checkout via shopify website - everything is going good.

The product has “Continue selling when out of stock” enabled, and variant is exists in the dashboard.
What can cause this problem ?

Hey Bajun - thanks for getting in touch. The most common reason this can happen is if the variant isn’t published/made available on your sales channel. If the issue still persists after you can confirm the variant is available on the sales channel, just repost here with an X-Request-ID from the response header of one of the “variant is invalid” responses you receive from Shopify and we’d be happy to look further into this with you.

Hope this helps!

Hi Alan!

Yeah, that was the reason - another app wiped all sales channels from the product and we missed it.

Thank you for your help!