call shopify api Creating a checkout response variantid is invalid

蓝咒 提交于 2021-02-10 16:26:14

问题


i call api Creating a checkout

the variant_id is 38894644552 is correct ,but this api response

variantid is is invalid
  1. get my shop variant id

    get https://suisui.myshopify.com/admin/products/9981337608/variants.json Response: { "variants": [ { "id": 38894644552, "product_id": 9981337608,...

  2. Creating a checkout with variant id

    POST /admin/checkouts.json HTTP/1.1 Host: suisui.myshopify.com X-Shopify-Access-Token: xxx Content-Type: application/json

    { "checkout": { "lineitems": [ { "variantid": 38894644552, "quantity": 3 }

    Response:

    { "errors": { "lineitems": { "0": { "variantid": [ { "code": "invalid", "message": "is invalid", "options": {} }

what's wrong with variantid 38894644552 ?

Thank you~


回答1:


Your app must be a sales channel for this api to work,

In Shopify Partners got to App Setup and it should look like this:

You will need to remove all existing installations to do this.




回答2:


The variant has to be for a product published to the checkout

e.g. After you've installed your checkout API app

  • go to products and locate the Sales Channels box.
  • Click Manage
  • Click your checkout channel
  • Click Done
  • click Save


来源:https://stackoverflow.com/questions/45005094/call-shopify-api-creating-a-checkout-response-variantid-is-invalid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!