Discussing APIs and development related to customers, discounts, and order management.
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.
Solved! Go to the solution
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).
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).
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.
It's primarily down to the country field.
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?
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.