Why I am getting shipping line invalid error even shipping line is correct?

sumit_israni
New Member
12 0 0

Hi, I am working on the sales channel app. For create checkout I am using checkout api. When I have update the shipping lines through checkout api, I got the below error, even shipping lines are correct. See below error

{"errors"=>{"shipping_line"=>{"base"=>[{"code"=>"invalid", "message"=>"is invalid", "options"=>{}}], "id"=>[{"code"=>"invalid", "message"=>"is invalid", "options"=>{}}]}, "shipping_rate"=>{"base"=>[{"code"=>"invalid", "message"=>"is invalid", "options"=>{}}], "id"=>[{"code"=>"invalid", "message"=>"is invalid", "options"=>{}}]}}}

I have looked for the reason for shipping line error but I couldn't able to find the reason. I want to know all the reasons of above errors when update shipping lines through checkout api. Please respond on above ASAP. Thanks

 

Replies 4 (4)

sumit_israni
New Member
12 0 0

Find request and payload below

PUT: https://devsquard-2.myshopify.com/admin/api/2020-04/checkouts/b06f117efdf7057bce2faa4d5898954d.json

{:checkout=>{:line_items=>[{:variant_id=>"36612219011240", :quantity=>1}, {:variant_id=>"36612218847400", :quantity=>1}], :token=>"b06f117efdf7057bce2faa4d5898954d", :email=>"tess01@shopoff.co", :buyer_accepts_marketing=>true, :billing_address=>{:first_name=>"Claire", :last_name=>"Clark", :address1=>"325 N La Salle Dr #300", :city=>"Chicago", :province=>"Illinois", :country=>"United States", :phone=>"(980) 279-8666", :zip=>"60654"}, :shipping_line=>{:handle=>"shopify-Standard-0.00"}, :applied_discount=>{:amount=>0, :title=>"Truupit Discount Order", :description=>"Promotional item for check handle"}}}

csam
Shopify Staff (Retired)
267 40 51

Hi @sumit_israni 

If you're creating a checkout, you'll want to use the POST method rather than PUT. PUT can be used to update/modify an existing checkout.

 

To learn more visit the Shopify Help Center or the Community Blog.

sumit_israni
New Member
12 0 0

@csamI am updating existing checkout as mention above payload.

gcascbt
Shopify Partner
1 0 0

Still get the error above after running this
https://gigl-test-store.myshopify.com/admin/api/2021-07/checkouts/96aedeb6047d7562798d16397396d7ca.j...

{"checkout": {"id": "96aedeb6047d7562798d16397396d7ca","shipping_line": {"handle": "gig-logistic-service-standard-2926.00"}}}
below is the responses
{
"errors": {
"shipping_line": {
"base": [
{
"code": "invalid",
"message": "is invalid",
"options": {}
}
],
"id": [
{
"code": "invalid",
"message": "is invalid",
"options": {}
}
]
},
"shipping_rate": {
"base": [
{
"code": "invalid",
"message": "is invalid",
"options": {}
}
],
"id": [
{
"code": "invalid",
"message": "is invalid",
"options": {}
}
]
}
}
}
Please help out