REST API Orders tags field used for filtering and searching

Shopify Partner
8 2 0

As I understand an API client cannot directly update the orders fulfillment_status field to mark orders as being processed as this field is immutable. Instead the API client must perform an action on the order by creating a fulfillments object for that order. This is understood and works in my client (please see my previous post for those unfamiliar with this):

 

https://community.shopify.com/c/Shopify-APIs-SDKs/REST-API-How-to-update-order-fulfillment-status/m-...

 

However, I am looking for a simple alternative for a client that still wants to directly update and then filter orders by marking them as "being processed". Could either the 'reference'* or 'tags' fields in an order be used for this purpose?

 

While I was able to successfully update the tags field of an order to any custom value (e.g. tags="processing") I was unable to download orders by using that filter value i.e. /orders.json?tags=processing. According to the docs (https://help.shopify.com/en/api/reference/orders/order#update-2019-07) the tags field can be used for filtering and searching:

 

tags
"tags": "imported"

Tags attached to the order, formatted as a string of comma-separated values. Tags are additional short descriptors, commonly used for filtering and searching. Each individual tag is limited to 40 characters in length.

 

* I tried updating the orders.reference field and it can't be updated, though I still get a success response and there's no mention in the docs what it's used for

0 Likes
Shopify Staff
Shopify Staff
1012 67 133

Hey @gdastgir ,

 

Tags are commonly used for filtering and searching, yes, but not necessarily via the API. For example, the order endpoint doesn't have the ability to filter orders by tag via a GET request. However, you can filter orders in the admin by tag. 

 

What you could do if you have a client that wants to be able to filter their orders by tag is add whatever tags you need to their orders, and then have them filter by tag in the admin and save that search for use later. It wouldn't help an app with generating a tag-based list of orders unfortunately, that you would have to do by polling their orders and sorting by tag manually. But it would still make their lives easier in the Shopify admin.

 

If you click the 'More filters' option from the orders index page in the admin here : 

2019-09-qrvy1-ferlp

 

 

 

And then choose the 'tagged with' option from the menu that will appear and enter in whatever tag you choose to filter with, it will generate a list of orders with that tag attached. Then you can use the 'Save filters' option right next to the 'More filters' you clicked earlier to save this search and use later, and it'll create a tab at the top of the orders listing that a merchant can click later to access the same search more quickly. 

 

 

0 Likes