Error 422 when creating Checkout

Solved
jelo
Tourist
4 1 0

I'm trying to create a checkout object. I'm using the shopify python 8.4.1 with API version 2021-04.

shopify.Checkout.create({"checkout": {"email": "jelo@bld.ai", "line_items": [ {"variant_id": 41075752632483, "quantity": 1} ]}})

 

I'm receiving the following error:

{
  "errors": {
    "line_items": {
      "0": {
        "variant_id": [
          {
            "code": "invalid",
            "message": "is invalid",
            "options": {}
          }
        ]
      }
    }
  }
}

 

My X-Request-ID is: 7be4f98a-60c0-471a-a126-b388182a1dba

0 Likes
jelo
Tourist
4 1 0

This is an accepted solution.

So it looks like you need to either (1) add products to your sales channel app via Admin API or (2) add your sales channel app manually from the store product page (see screenshot).

Screen_Shot_2021-07-26_at_4_52_15_PM.png


I hope there was a guide that pointed me here. I only found a relevant thread that gave me the idea.

Also, it would have saved me a couple of days of work if the error message is a bit more descriptive like: "This product is not yet included in your product listing. See ProductListing resource for more information: https://shopify.dev/api/admin/rest/reference/sales-channels/productlisting"

0 Likes