Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: Draft Order API > Tax Calculation

Solved

Draft Order API > Tax Calculation

Ceri-Waters
Shopify Partner
98 6 30

Hi Shopify,

 

Bit of an odd one.. if I create a draft Order via the Draft Order API without a shipping/billing address the TAX is automatically calculated (defaulting to the stores country).

If I create a Draft Order with a billing & shipping address (the address being in the same country), no TAX is added. Tax exempt is set to false, and the order is very basic with a a single item specified via its variationID. If I go in and edit this order, and add a space to the shipping address (so that I can re-save it), the TAX is calculated correctly.


Am I missing something??
Thanks,
Ceri.

Accepted Solution (1)

Ceri-Waters
Shopify Partner
98 6 30

This is an accepted solution.

Nevermind, I've answered my own question. The admin will default to the Stores Country, the API does not (so if you provide a partial address it fails the TAX lookup).

View solution in original post

Replies 5 (5)

Ceri-Waters
Shopify Partner
98 6 30

This is an accepted solution.

Nevermind, I've answered my own question. The admin will default to the Stores Country, the API does not (so if you provide a partial address it fails the TAX lookup).

Simonistaken
Shopify Partner
18 1 2

Hi,

I encountered the same issue.

The address is never accurate via the API. I also tried to put in the full name of the address, e.g. transform "123 W King st" into "123 King Street West", but no luck. 

I need the Address to be accurate via API creation so that the Draft Order can determine the Tax based on the location. 

How did you end up solving this issue? 

Is there a way to get around to get the Tax rate correctly?

Thanks. 

 

We care about growth and conversion by providing suitable solutions.
Like it if you find the answer is helpful.
Accept as Solution if your question is resolved.
If neither, DM me and I will help you out.
Ceri-Waters
Shopify Partner
98 6 30

It's primarily down to the country field.

Simonistaken
Shopify Partner
18 1 2

Thanks for the response. 

But that doesn't work for our case. Our client is based in Quebec, Canada. But the tax should be determined depends on the customer's shipping location, while the provincial tax is different in Canada (similar to the US). 

If we can't get the Address being determined correctly via API creation, there will be a problem getting the right tax rate in Canada. 

Any suggestions? 

We care about growth and conversion by providing suitable solutions.
Like it if you find the answer is helpful.
Accept as Solution if your question is resolved.
If neither, DM me and I will help you out.
Ceri-Waters
Shopify Partner
98 6 30

You'll need to ensure that you have both Country and Provinence in that case created with your Draft Orders on the Shipping Address. If you have a form on the front-end which is used in the Draft Order Creation you can use Shopify's countries.js file to get a list of countries and their associated provinence.

Alternative;y you could use the Country API endpoint to get your countries/provinence list which can then validate the back-end too.
https://shopify.dev/api/admin/rest/reference/store-properties/country

If you don't have somewhere for customers to enter their address, leaving it blank and then directing them to the Draft Order should in theory mean they have to fill in the address details and then the appropriate tax amounts will get calculated.