Ad

Shopify - New Order Using The Shopify API - How To Know Tax And Shipping?

- 1 answer

We have built an e-commerce web application (Node backend, Vue frontend). We process the payment using Stripe, but many brands have asked us if the order and inventory control can be done in Shopify. We are trying to figure out the best way integrate a payment module into Shopify so that the brand can manage the fulfilment and inventory through Shopify.

It seems we should use the Order API to create an order and mark it as paid. But how do we know that the product is in stock, and what are the cost for shipping and tax from Shopify when creating the order? I think we can use the Product API to get inventory levels, but where is the shipping and tax endpoints?

If I understand the Order API correctly, we need to tell Shopify what are the shipping costs and tax costs, when a new order is created. Is that right? How could we possibly know those figures? Seems like there should be an endpoint to calculate shipping costs and get a product's tax rates so that we can then pass those figures back into the Order API. Am I missing something?

I thought maybe we are supposed to create an order that has financial_status: pending first to get shipping and tax rates back (does it even give you those?), then update the order to either cancel_reason: customer or cancel_reason: inventory if those rates are too expensive and the order is declined? But surely we need to know what shipping methods are available to the customer in order to tell Shopify which one to use, right? Or does it by default choose the cheapest one when creating an order?

Notes:

  • We know the customers shipping address
  • We don't know where the product is warehoused (Shopify does I think)
  • We don't know the weights or dimensions of the product (Shopify does I think)
Ad

Answer

This answer is a little bit late, but i hope, i can help others that are struggling with the same issue.

First i would recommend to set up all Shipping Rates and Taxes in Shopify. There are plenty of manuals to achieve this:

https://help.shopify.com/manual/taxes#general-process-to-set-up-taxeshttps://help.shopify.com/manual/shipping/rates-and-methods/calculated-rates

After this there are different possibilities to calculate your shipping and tax cost.

Your shipping cost can you get via the active_shipping API, which can be found here: https://github.com/Shopify/active_shipping

Or the following Shopify Application: https://apps.shopify.com/boxify

However, you may need to know size and storage location foref="https://github.com/Shopify/active_shipping" rel="nofollow noreferrer">https://github.com/Shopify/active_shipping

Or the following Shopify Application: https://apps.shopify.com/boxify

However, you may need to know size and storage location for theese solutions.

The taxes can you get via the country in the Admin API, there is a specific key-value pair for this: https://help.shopify.com/api/reference/country

I hope that's enough information to get closer to solving the issue, for at least someone.

Ad
source: stackoverflow.com
Ad