Discussing APIs and development related to customers, discounts, and order management.
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?
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
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.
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
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
}
}
}
}
Use the word TAG instead of TAGS.
https://{store}.myshopify.com/admin/api/2021-01/orders.json?tag=readytoship
@MStockSpeedling thanks for that.
when testing this i ensountered the fact that it is defaulting to open orders with the tag in question.
if you want all orders of any status that match the tag then you need
https://{store}.myshopify.com/admin/api/2021-01/orders.json?tag=readytoship&status=any
just in case that is useful for anyone
For API version 2023-07
The request must be sent through Query
GET /admin/api/2023-07/orders.json?status=any&query=tag:Pendiente
This worked for me!