How to Update an Order in Shopify

  • 25 November 2020
  • 3 replies
  • 726 views
How to Update an Order in Shopify
Userlevel 3

Hey Zapier Community! Jared here from the Zapier Support Team.

Have you ever wanted to update an order in Shopify using Zapier?

Maybe add tags or change the email address associated with the order.

If so - you might have noticed that Zapier doesn’t currently have an action to Update an Order in Shopify.

We can create an order but not update one.

However - there is a way to update at least some of the data on an existing Order using Webhooks by Zapier.

Webhooks by Zapier

My first thought when we don’t have an existing action is maybe we can use Webhooks by Zapier to send the request.

In order for that to work we need 2 things to be true.

  1. The App has to provide Basic Authentication or API Key authentication for their API. If they require OAuth - Webhooks by Zapier won’t work.

In this case - Shopify does provide API Key and Password access to the API. This link describes how to generate those credentials in your Shopify account by creating a Private App.

When setting that up - you’ll want to be sure to give the Private App Read & Write access to Orders since we’ll need that level of access to be able to update the Orders.

  1. They have to have an endpoint for updating the Order.

And Shopify does. You can see the full details on that endpoint here:

https://shopify.dev/docs/admin-api/rest/reference/orders/order#update-2020-10

Adding a Tag to an Existing Order

So now that we have our Endpoint and our Credentials - we can set up our Zap.

It’s important to note that your Zap will have to give you the Shopify Order ID from a previous step. We don’t have the ability to search for an Order in Shopify.

As an example - any of Zapier’s Shopify Order Triggers (like New Order or Updated Order) would provide the Order ID.

But you might also keep that Order ID in your CRM or a Google Sheet.

In my Zap below - I’m using Shopify New Order (Any Status) for my trigger since I know that will give me the Order ID.

Then at Step 2 - we’ll use a Webhooks by Zapier Custom Request.

When you set up your Shopify API Key - you’ll get an example URL that will have the important details you’ll need.

We can see in that screenshot that the general structure of the url is:

https://{apikey}:{password}@{hostname}/admin/api/{version}/{resource}.json

Everything before /admin - you can get from the sample URL that Shopify gives you.

Everything after that you can get from the Shopify Order Endpoint documentation.

In this case we want to update (PUT) an order and Shopify says that we should use the following endpoint to do that:

/admin/api/2020-10/orders/{order_id}.json

So the URL we will use for our PUT request is:

https://{apikey}:{password}@{hostname}/admin/api/2020-10/orders/{order_id}.json

Again - you would replace everything before /admin with the values that Shopify gives you for your store.

I’m using non-working testing values below just so I can show you the complete screenshot. :)

So let’s go through each piece of the Custom Request.

  1. Method

For the Method - we are using PUT. This is typically the method that would be used to update a record via an API.

  1. URL

For the URL - we’re using the structure from above. The one thing to note here is that we have mapped in the Order ID from the trigger. This way it will update dynamically each time the Zap runs.

  1. Data

For data we’re using the structure that Shopify provided us here:

Again note that we have mapped in the Order ID from the trigger so that it updates dynamically when the Zap runs.

I’m only using 1 tag in my test but you can do multiple tags separated by a comma like the example above.

  1. Headers

Under the header section you’ll want to put “Content-Type” on the left and “application/json” on the right.

And that’s it! All the other settings can remain at their default values.

Clicking Continue and then testing the Action - shows the Tag is indeed Added to the Order in Shopify!

What Can We Update?

So now that we know we can send a Webhook to update the order in Shopify - exactly what can we update on the Order?

First - I wasn’t able to update Draft Orders - only Orders that had already been created.

My test was for Tags specifically - but Shopify provides examples in their documentation for updating the following information on an Order.

  • Add a note to order

  • Add note attributes to an order

  • Change an order's email address

  • Change an order's phone number

  • Change whether the buyer accepts marketing

  • Add a metafield to an order

  • Update the shipping address of an order

  • Remove the customer from an order

  • Update an order's tags

I hope this post helps you build more powerful Shopify Zaps knowing there is a way to update some of the data on the Orders.

Thank you for reading and please feel free to provide any of your own examples of updating an order in Shopify in the comments below!


3 replies

Userlevel 7
Badge +10

Thanks for this walkthrough @Jared - very handy!

so no way to create draft orders?

Userlevel 3

Hi @chanocg - thanks for your comment!

We don’t have a way to create Shopify Draft Orders directly in Zapier at the moment. If you write into us at contact@zapier.com - we can add you to the feature request for Draft Orders.

You should be able to use the steps above to generate the API Key and then use Webhooks by Zapier to make a POST request to Shopify’s Draft Order Endpoint to create a Draft Order.

https://shopify.dev/docs/admin-api/rest/reference/orders/draftorder#create-2021-04

From a Zap perspective - this could get complex in a hurry depending on exactly what you want to include in the Draft Order (customer ID, variant ID, discounts, line Items, etc...)

But it would be possible to create a Shopify Draft Order using Webhooks by Zapier.

And Shopify’s link above has some good examples of what that JSON code would look like for different scenarios.

Reply