Get orders by tags?

developer8971
Tourist
44 0 2

Hi Guys,

 

I have a CSV list of order numbers (from another system) which I have tagged into the Shopify orders.  Is there a way to read all the Shopify orders by the tag?

 

Alternatively, the order number (from the other system) is also in the Notes section of the Shopify Order but includes some other text around it.  Not sure if there's a way to do a "contains" search or regex matching?

0 Likes

Hi,

 

I would do something like this:

 

GET /admin/orders.json?tags=[ comma seperated list of tag values ]

 

I think the output will be sorted by orderdate. I don't think its possible to sort by tag value.

 

You can read more here: https://help.shopify.com/en/api/reference/orders/order#index

 

 

Best regards

Good luck

Shopify PageSpeed Expert | Speed up your Shop and Earn 45% more, Get 31% more Traffic and Boost Conversion Rates by 20%
0 Likes
michaewa
New Member
1 0 0

Were you able to get this to work?

 

I'm using a GET request to admin/api/2019-07/orders.json?tags=M4U

 

There is only one order with this tag, but I'm getting back dozens of results, not including the one that has this tag.

0 Likes
msk
Excursionist
28 5 3

hello,

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. 

 

Thanks

0 Likes
Greg_Kujawa
Shopify Partner
965 80 204

This is doable using the GraphQL API. Although I believe the search is fuzzy based on recent posts on here. But that's a bit up in the air. Here's an example of a working test case:

 

 

 

{
  orders(first: 10, query:"tag:test_tag") {
    edges {
      cursor
      	node {
        	id
          name
          tags
      }
    }
  }
}

 

 

 

0 Likes