Create draft order/ checkout is not calculating tax through API

Highlighted
Shopify Partner
3 0 1

HI,

I'm trying to create a new draft order or checkout, with shipping address, billing address, and shipping rate.

and I get entity with all the parameters  and calculated shipping rate.

BUT the tax is not included, it's not calculating the tax for the product as it does in the UI.

The response I get is:

 

{
"draft_order": {
"id": 432100006432,
"note": null,
"email": "adambe@gmail.com",
"taxes_included": false,
"currency": "USD",
"invoice_sent_at": null,
"created_at": "2020-02-20T06:48:35-07:00",
"updated_at": "2020-02-20T06:48:36-07:00",
"tax_exempt": false,
"completed_at": null,
"name": "#D59",
"status": "open",
"line_items": [
{
"variant_id": 32333986061422,
"product_id": 4544406532649,
"title": "hoodie",
"variant_title": "Classic",
"sku": "11",
"vendor": "hoodies club",
"quantity": 1,
"requires_shipping": true,
"taxable": true,
"gift_card": false,
"fulfillment_service": "manual",
"grams": 100,
"tax_lines": [

],
"applied_discount": null,
"name": "Green Hoodie",
"properties": [

],
"custom": false,
"price": "2.00",
"admin_graphql_api_id": "gid://shopify/DraftOrderLineItem/54675662962700"
}
],
"shipping_address": {
"first_name": null,
"address1": "83034 Terry Ave",
"phone": "800-000-0000",
"city": "Seattle",
"zip": "98121",
"province": "Washington",
"country": "United States",
"last_name": "Smith",
"address2": null,
"company": null,
"latitude": 47.61719009999999,
"longitude": -122.3350965,
"name": "Smith",
"country_code": "US",
"province_code": "WA"
},
"billing_address": null,
"invoice_url": "https://all-in-dollar.myshopify.com/32093929609/invoices/a60b0ooob974t293e065e4ae372b2aab",
"applied_discount": null,
"order_id": null,
"shipping_line": {
"title": "Standard",
"custom": false,
"handle": "shopify-Standard-10.00",
"price": "10.00"
},
"tax_lines": [

],
"tags": "",
"note_attributes": [

],
"total_price": "12.00",
"subtotal_price": "2.00",
"total_tax": "0.00",
"customer": {
"id": 3117321381333,
"email": "adambe@gmail.com",
"accepts_marketing": true,
"created_at": "2020-02-12T06:38:54-07:00",
"updated_at": "2020-02-20T06:11:55-07:00",
"first_name": "Adam",
"last_name": "Bell",
"orders_count": 15,
"state": "enabled",
"total_spent": "173.00",
"last_order_id": 2031755953335,
"note": "",
"verified_email": true,
"multipass_identifier": null,
"tax_exempt": false,
"phone": null,
"tags": "",
"last_order_name": "#1015",
"currency": "USD",
"accepts_marketing_updated_at": "2020-02-12T06:38:54-07:00",
"marketing_opt_in_level": "single_opt_in",
"tax_exemptions": [

],
"admin_graphql_api_id": "gid://shopify/Customer/3117321381333",
"default_address": {
"first_name": null,
"address1": "83034 Terry Ave",
"phone": "800-000-0000",
"city": "Seattle",
"zip": "98121",
"province": "Washington",
"country": "United States",
"last_name": "Smith",
"address2": null,
"company": null,
"latitude": 47.61719009999999,
"longitude": -122.3350965,
"name": "Smith",
"country_code": "US",
"province_code": "WA"
}
}
}
}

 

As you can see the tax is empty.

Ay ideas?

 

Thanks!!

0 Likes
Highlighted
Shopify Staff
Shopify Staff
587 72 129

Hey @zivmiz,

 

When creating draft orders through the API, it's possible to get a response before shipping+tax calculations are finished. From our docs:

 

When you create and update draft orders some calculations are done asynchronously, such as calculating shipping and taxes. There might be times when a draft order is created but these calculations haven't completed. In these cases, you need to poll the draft order until the calculations are finished.

Can you confirm the response code you received after making your draft? If it was a 202 accepted, that means the calculations weren't finished, and you need to poll the order again to get the updated values once it finishes.

 

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

0 Likes