How to filter Shopify Orders by multiple tags
Have you ever needed to filter your Shopify orders by more than one order tag in the Shopify Admin?
If so, then you'll know that this is not easy to achieve via the Shopify Admin. This can be frustrating when you're using an app like Order Tagger to create a tagging taxonomy structure, but don't have any way to filter your Shopify orders by more than one tag at a time.
There is, however, a way to filter Shopify orders by multiple tags, but it does require a little bit of fiddling about with the Shopify Admin URL that you see in your browser.
We'll try to demonstrate how you can use multiple tags by changing the Shopify Admin URL as well as how you can choose to exclude orders that contain certain order tags.
Interested? Then please read on to find out how you can customise this URL to filter your Shopify Orders by more than one tag.
Why can't I filter Shopify Orders by multiple tags in the Shopify Admin?
The simple answer is that we don't know, but there must be a good reason for it. There's probably a processing overhead which slows down the retrieval and display of the orders in the Shopify Admin, but equally, it may just have been overlooked or not be very high on Shopify's priority list.
The typical way to filter your Shopify Orders by tag is to use the More filters option from the toolbar in the Orders Listing View and then enter a single tag into the Tagged with filter input field:
As you type, the Orders Listing View will update and start filtering orders based on the name of the tag that you are typing:
You can try and add in multiple tags here by separating them with a comma, but the cursor begins to bounce around in the text input field, adding random spaces between the tags which then produces varying results in the updated Orders Listing View:
Constructing the Shopify Admin URL to filter orders by multiple tags
The solution is to use Shopify's API search syntax and to curate the Shopify Admin URL manually to return a filtered view based on more than one order tag.
Display orders that contain multiple tags
If you visit the Orders Listing View within the Shopify Admin, you'll see a URL in your browser similar to the one below:
https://yourstore.myshopify.com/admin/orders?selectedView=all
What you then need to do is add a query variable to the end of that URL. Here is how that variable begins:
&query=
You'll then need to add the first tag that you're looking to filter your orders by. In this example, the tag I wish to filter by is UNITED KINGDOM:
&query=tag:"UNITED+KINGDOM"
To then add another tag to the filter, you will join the two tag searches by adding +AND+ at the end of the URL:
&query=tag:"UNITED+KINGDOM"+AND+
Now specify the second tag name that you're looking to filter your orders by. In this example, we will use the tag first_time_customer:
&query=tag:"UNITED+KINGDOM"+AND+tag:"first_time_customer"
Your full URL should then look something like this:
https://yourstore.myshopify.com/admin/orders?selectedView=all&query=tag:"UNITED+KINGDOM"+AND+tag:"first_time_customer"
Hit return once you've amended the URL in your browser and you should be presented with a view of Shopify Orders that contain both of the tags that you have specified.
Display orders that contain a tag but not another tag
If you're looking to exclude orders from the Orders Listing View if they do not contain certain tags, then there is also a way to do this.
In this example, we want to filter the Orders Listing View to only display order that contain the tag spend100 but do not contain the tag first_time_customer.
Start by constructing the URL in the same format as mentioned previously to specify the tag that the orders must contain:
&query=tag:"spend100"+AND+
Now we introduce the negative operator (minus sign) in front of the second tag attribute to specify that this tag must not be on the order like so:
-tag:
Here is how that will look with the other attributes:
&query=tag:"spend100"+AND+-tag:"first_time_customer"
Putting that altogether, your URL should look something like the following:
https://yourstore.myshopify.com/admin/orders?selectedView=all&query=tag:"spend100"+AND+-tag:"first_time_customer"
Hitting return, you should now see orders in the Orders Listing View that contain the first tag specified in the URL, but do not contain the second tag specified in the URL.
That's it! You can add in as many tag filters as you need, using a combination of tags the order must contain and tags that the order must not contain.