Skip to main content

May 9, 2024 update: An Update Order action is now available for the Shopify app on Zapier which will allow you to update existing orders!  

 

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!

Thanks for this walkthrough @Jared - very handy!


so no way to create draft orders?


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.


@Jared any insight into editing selected shipping method? We have orders coming in without a selected shipping method and simply want to edit method to a default, “ground shipping”. 

 


Hey @Krantzm - I’d definitley recommend for you to reach out directly to Shopify to confirm - but I don’t think there is a way to do this through their API.

It looks like their documentation was updated recently (July 2021).

The bullets at the end of my original post above were taken directly from the Shopify API Documentation at the time I wrote the post.

At that point - it said:

Update the shipping address of an order

 

When I look now - it says:

 

shipping_address_attributes

 

My guess is that nothing has changed and it is just these fields boxed in Green under the Shipping Address heading and not the fields boxed in Red under Shipping Lines - which is where I would expect you’d add the default Ground Shipping. 

 

So I don’t think it is possible because I don't think we can update the Shipping Lines section via Shopify’s API - but their support team should be able to confirm that for you.


This is great - thank you - has helped me a lot.

However, it seems that if this run more than once on an order - ie: adding multiple tags - the newest one will overwrite all the existing tags.

IE - it’s not appending a new tag, it will replace all of the tags with the latest addition.

Do we know if there is any way to append a tag rather than overwrite?

Thank you!


Hi there!

 

I wonder if there is a way to add a tag for orders that used a certain discount code?


Hi @Jared, Thanks for putting this great shopify update tip here.

By the way, does the the ability to update orders extend to the object product… e.g. tags, metafields etc?

In particular, I am find a way to update the product custom field (i.e. metafields.my_fields.namespace.key).

Appreciate your reply on the above.

Keep up the good work!


Hey there @HM17@Luna and @PhilipW

I’ve done some checking and it looks like Shopify’s API allows for order metafields to be updated:

48eee7272e5ea8d7dc07e566852648eb.png

You can see the full documentation for the Update an order endpoint here: Shopify > Update an order 

If existing tags are being overwritten then you may need to use a webhook looking at the Retrieve a specific order endpoint to obtain the existing tags for the order, and add those to the list of tag(s) that are being added. That way the webhook will re-add the existing tags along with the new one(s). 

And for applying specific tags depending on the discount code used I’d suggest using Filters or Paths to add the necessary conditional logic to the Zap to allow you to add different tags based on the code used. You can find out more about working with Filters and Paths here: 


Hope that helps! 🙂


Hi @SamB,

Thank you for taking the time in replying.

Actually, my question was whether the ability can be extended to updating Shopify product’s metafields instead of the object Oder’s metafields.

Our previous email inquiry on whether shopify product metafield update via zaps is possible to one of your peers came back negative. 

Hence this new inquiry whether we can update the product metafields via private app similar to the one put by @jared.

Now, we have learned that Shopify has done away with the ability to create private apps.  I was wondering whether creating a custom app would allow us to replicate the functions by private apps and if the steps are the same.

Appreciate your reply.


Ah, I see. Thanks for clarifying that, @PhilipW

It looks like Shopify’s API has the ability to update a product’s metafields: Updates a metafield

b1a2472f48c962cd6362e02541549193.png

So it would appear that you could update them using a custom request webhook step, similar to how Jared described above. Or you could build a custom integration with Shopify to create an action that would allow you to update a product’s metafields.

There’s a fair bit more work involved in building a custom integration than setting up a webhook step. But if that’s something you’re interested in pursuing you can find out more about how to build an integration on the Zapier platform here: Zapier Platform > Quickstart 🙂


Hi @SamB, Thanks for the update.

Will surely look at the link you provided.

Cheers!


What a helpful and clear guide, thank you!

Do you know if it is possible to change/update the customer assigned to a particular order via the API? As you said in your article, Shopify gives an example of removing a customer from an order, but I can’t find anything about assigning the order a new customer! It leads me to believe it’s not possible, but that doesn’t seem right.

I’d be interested to know if anyone’s had that same issue!


Hey all, would it please be possible to help me with an example of updating a metafield within an order? I have checked the documentation but I just can’t see how you identify the metafield to be updated.

 

Thanks!


The Custom Request action isn’t available anymore. Is this possible with the new Webhooks by Zapier?


Do you know if you can edit payment status in Shopify? For example, if a Google Sheet payment status for a specific order is marked from “pending” to “paid”, then it will also update the same order in Shopify from “pending” to “paid”.


Shopify no longer gives you an example URL, how would I go about finding what values to use for PUT request?

It looks like authentication is done by including your API Access Token as a header, but that is not working for me.

 

 


Hey folks,

i just started using zapier and it looks promising. I am using the Shopify Integration by Zapier which is in beta-phase at this moment.

I also want to update a metafield of an existing order. I achieved it by adding an “Api Request (Beta) in Shopify” and using the api-url as provided in the documentation: 
https://shopify.dev/docs/api/admin-rest/2024-01/resources/order#put-orders-order-id

It works like a charm WHEN the field is empty. But if the field has already a value the PUT-request returns also a 200 success message, but nothing changes. The metafield still has the old value.

So i am a bit confused, because the Shopify-Documentation doesn’t provide not much information on this.

I have the feeling that it could be a permission problem: As i am using the Shopify-Integration, i installed the zapier App and give permissions to this app. Maybe the App is not getting the correct permissions to rewrite metafields of an order?


Thanks for this tutorial.  Is it possible to create a zap to fulfil an order? 


Reply