I have found that you can filter by adding something like "tag:whatever" to the search query. For example you'd search "sweater tag:kids" to get all sweaters with the tag of kids.
I haven't been able to get it working as a hidden field yet though which is what I really want. A query parameter for it would be really useful. The list of available query parameters is pretty limited https://shopify.dev/tutorials/use-advanced-query-parameters-in-shopify-online-store-search.
Filtering the results using liquid on the results page doesn't work because the first page could be blank since pagination sees items, you just aren't rendering them.
Update with my hacky solution: This adds the tag before the search submits, I then remove the tag from the search results when they're rendered.
window.onload = function() {
document.getElementById('searchform').onsubmit = function() {
var txt = document.getElementById('query');
txt.value = txt.value + ' tag:adult';
};
}
User | Count |
---|---|
49 | |
27 | |
25 | |
23 | |
23 |