Getting 422 Unacceptable Entity error

New Member
6 0 0

@hassain 

For require shipping false here is request id
X-Request-Id 71b5a173-f403-4ebc-8933-9848ca944f5a

Request Body

{
  "checkout":{
    "email": "akhtar.ali+22@kiwitech.com",
    "line_items": [{
      "variant_id": 31447125590094,
      "quantity": 1
    }],
	"billing_address": {
	  "first_name": "Akhtar Test sdfs",
      "last_name": "Order",
      "address1": "B-9, Sector 3",
      "city": "Noida",
      "province_code": "UP",
      "country_code": "IN",
      "phone": "8447737843",
      "zip": "201301"
	}
  },
  "requires_shipping": false
}

Response we get 

{
    "checkout": {
        "completed_at": null,
        "created_at": "2019-12-04T05:49:01-05:00",
        "currency": "USD",
        "presentment_currency": "USD",
        "customer_id": 2785870577742,
        "customer_locale": "en",
        "device_id": null,
        "discount_code": null,
        "email": "akhtar.ali+22@kiwitech.com",
        "legal_notice_url": null,
        "location_id": null,
        "name": "#12114394251342",
        "note": "",
        "note_attributes": {},
        "order_id": null,
        "order_status_url": null,
        "order": null,
        "payment_due": "10.00",
        "payment_url": "https://elb.deposit.shopifycs.com/sessions",
        "payments": [],
        "phone": null,
        "shopify_payments_account_id": "acct_1Ez0WbCNlo40OyHu",
        "privacy_policy_url": null,
        "refund_policy_url": null,
        "requires_shipping": true,
        "reservation_time_left": 0,
        "reservation_time": null,
        "source_identifier": null,
        "source_name": "3066999",
        "source_url": null,
        "subscription_policy_url": null,
        "subtotal_price": "10.00",
        "shipping_policy_url": null,
        "tax_exempt": false,
        "taxes_included": false,
        "terms_of_sale_url": null,
        "terms_of_service_url": null,
        "token": "3ca4bd51b8559115f360d96ec8d5d8fb",
        "total_price": "10.00",
        "total_tax": "0.00",
        "total_tip_received": "0.00",
        "total_line_items_price": "10.00",
        "updated_at": "2019-12-04T05:49:01-05:00",
        "user_id": null,
        "web_url": "https://topfantest.myshopify.com/25649152078/checkouts/3ca4bd51b8559115f360d96ec8d5d8fb",
        "line_items": [
            {
                "id": "b7386f19f76952598fcb9c42ad4e9230",
                "key": "b7386f19f76952598fcb9c42ad4e9230",
                "product_id": 4421075664974,
                "variant_id": 31447125590094,
                "sku": "",
                "vendor": "topfantest",
                "title": "Polo T Shirt",
                "variant_title": "Medium / Blue",
                "image_url": "https://cdn.shopify.com/s/files/1/0256/4915/2078/products/download_3.jpg?v=1575438326",
                "taxable": false,
                "requires_shipping": true,
                "gift_card": false,
                "price": "10.00",
                "compare_at_price": null,
                "line_price": "10.00",
                "properties": {},
                "quantity": 1,
                "grams": 0,
                "fulfillment_service": "manual",
                "applied_discounts": []
            }
        ],
        "gift_cards": [],
        "tax_lines": [],
        "tax_manipulations": [],
        "shipping_line": null,
        "shipping_rate": null,
        "shipping_address": null,
        "credit_card": null,
        "billing_address": {
            "id": 5497545130062,
            "first_name": "Akhtar Test sdfs",
            "last_name": "Order",
            "phone": "8447737843",
            "company": null,
            "address1": "B-9, Sector 3",
            "address2": null,
            "city": "Noida",
            "province": "Uttar Pradesh",
            "province_code": "UP",
            "country": "India",
            "country_code": "IN",
            "zip": "201301"
        },
        "applied_discount": null
    }
}

still we are getting require "requires_shipping": true

 

 

0 Likes
Shopify Staff
Shopify Staff
220 36 37

Hey @akhtarkiwi ,

 

As per the official documentation for the Shopify Checkout API, the “requires_shipping” field is a “READ-ONLY” setting. This means you cannot set, change, or update the value of "requires_shipping" field through this API, you can only read it. So even if you pass in "requires_shipping" as false in your payload for the create Checkout POST request, the API will not accept this input.
 
The “requires_shipping” field will be set to false if and only if all the products in the line items of the checkout are set up as non-physical items that do not need to be shipped. To set this up for a product, go to your Shopify Store’s admin page (i.e. sample-test-store.myshopify.com/admin), and in the left hand side of the screen go to Products -> select the product you want to update —> Scroll down to "shipping" —> Uncheck the option for “This is a physical product". Now when you create a new checkout for this product via the Checkout API POST request, you will see that "requires_shipping" will always be false.
 
If your items are physical products but they do not need to be shipped (i.e. they are picked up by customers locally), then another option could be to set-up a new manual shipping rate for free shipping (read how to do that here). Now when you create the new Checkout POST request, in the payload you can specify this free shipping rate. You will still need to include the "shipping_address" in the payload and "require_shipping" will still default to true, but at least there will not be an additional charge for shipping. 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
New Member
6 0 0

@hassain Ok, got it.

I have one question regarding calculation of shipping cost for draft order.
For draft order if we have to add shipping_line 

"shipping_line": {
  "handle": "shopify-Standard%20Shipping-8.00",
  "price": 0.0,
  "title": "Free Shipping"
}

I am unable how we find this handle, but i am able to get all carrier services of the stores by using below api

/admin/api/2019-10/carrier_services.json

Can you please help me in this

0 Likes
Highlighted
Shopify Staff
Shopify Staff
220 36 37

Hey @akhtarkiwi ,

 

I believe this endpoint should hopefully help you get what you are looking for:

 

https://help.shopify.com/en/api/reference/sales-channels/checkout#shipping_rates-2019-10

 

Let me know if this helps or not!

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
New Member
6 0 0

@hassain Yes we can find shipping rates, but we have to created a checkout for it. I want to know that is there an api to calculate these shipping rates for draft order? We don't want to create a checkout then fetch the shipping rates.
As in shop admin we can attach shipping rates to draft order. Please see the attached screenshotsScreen Shot 2019-12-09 at 11.51.23 AM.pngScreen Shot 2019-12-09 at 11.51.37 AM.png

0 Likes
New Member
6 0 0

@hassain 
When i am creating checkout i am getting  "Checkout System disabled" error and code is "403".

 

below are the info you might required

 

X-Request-ID -> 28a944d0-4132-48ca-bbea-3cb415bf02f3
Store is -> topfantest.myshopify.com

Its urgent can you please check what is the reason for it

0 Likes