Patrick Feller - Produce Market, Airline Dr., Houston, Texas 0811091717 - Flickr

Search by Product Tag for Woocommerce

Downloadwoocommerce-searchbyproducttag-0.3.1.zip

Download at wordpress.org

UPDATE 14/03/2014: Version 0.3.1 has been released on wordpress.org get it using the download above. It removes all duplicates and has compatibility with WPML plugin as well as testing up to wordpress 3.8.1 and woocommerce 2.1.5

The default install of woocommerce does not come with any searching capabilities based on the tags that can be assigned to each product.

I have written this plugin to add this capability to the search on both the front end of your woocommerce site and in the wordpress admin site. There is no extra config apart from installation and activation of the plugin.

You can search by multiple tags by splitting your search with a comma. For example to search for all products tagged with toys and helicopter enter into the search box: “toys, helicopter” and all products with those tags will be returned in the search.

The search functionality in woocommerce doesn’t search by product tags by default. This simple plugin adds this functionality to both the admin site and regular search. It is very useful if you want to add some extra meta information to a product that will increase the discoverability on certain products.

If you have any issues or feedback feel free to leave a comment on this post and I will try and sort is as soon as possible

Disclaimer: This plugin does a mysql query with several joins upon each search. If you have an extremely large store (Eg 20, 000 products) you may be better off using a more generic search solution that builds its own optimised indexes for more speedy searching. If however you own a comparatively small store (less than 5, 000 products) this plugin will probably suit you better.

(Image Credit Patrick Feller  Flickr)

63 thoughts on “Search by Product Tag for Woocommerce”

    1. Hi Katerina.

      Are you using the newest version of woocommerce? (currently 2.0.3)

      I haven’t tested this with any of the 2.x releases yet and I have had similar reports of another plugin of mine malfunctioning when using the newest version.

  1. Hey,

    Thanks for some great plugins! Do you know if there is anything out there that allows the user to search by variations? If someone wants to see what shirts we have in stock in a large, in theory they should be able to do a quick search for large, but this doesn’t seem to be possible.

    1. I believe the official search plugin from woocommerce does this: http://www.woothemes.com/products/product-finder/ but it uses its own search interface rather than hijacking the search box like my search plugins do. I might do another plugin this weekend with this functionality as the product attributes are stored internally in a similar way.

  2. Is there a fix yet for error we get when more than 1 product has the same tag(s).

    This is the error I get:

    Fatal error: Call to a member function is_visible() on a non-object in /home/content/78/11242778/html/wp-content/plugins/woocommerce/templates/content-product.php on line 25

    1. Hi Scott,

      This plugin has been neglected by me for a little while I will bring it up to scratch this weekend and move it to wordpress.org. – Keep an eye out for it.

  3. Thankyou! The lack of such a feature was driving me up the wall! As far as I can see, this is the most important search function in a shop.

  4. Woocommerce plugin

    Good day

    I am looking for Woocommerce plugin for checkout page.
    Do you have a way that customers checkout page filling their credit card to my database and not automatic getaway via third party company such as PayPal or all other.

    I need that a page with fields for credit card number, expiry date, ID number, and CCV.
    I am willing to pay for such as plugin.
    Regards
    Yaron

  5. Hi Mathew!

    Just sending this message to know if you could re-make this plugin so it can work on woocommerce 2.0 😉

    Thanks bro for your effort…. i can´t understand why this people of woocommerce doesnt consider the search functionality as one of the priorities!

    1. This will be coming very soon. I have promised to do it a couple times but always find myself sidetracked by something else urgent.

      A fix will be soon though, I promise …

    2. The support for WC 2.0 has now been added. Please update with the link in the blog post. The way the product tag search works is probably not the most efficient with the way the database is structured, hence why I don’t recommend it for massive stores. Woo might be working on their own version with proper indexes more similar to sphinx or some the the more generic search plugins out there.

  6. Hello Mattthew,

    It’s great plugin but it breaks the second more than one product has the same tag.

    Do you have any solution for this?
    thank you very much!

  7. Hi Matthew, thanks for the plug in, really helped my works.

    I already tried the 0.2 version, works great compared with the previous version..

    however I want to ask, since I got request for client to exclude some products with some criteria ONLY in the front end ( I already done the request by add some codes in the archive product page when query the posts- filtering query using post__In ), is it possible to combine your query result in searching by tag with result that I got in the front end?

    To make it clear, i give an example. I got products A, B, C, D.

    the tag for them, lets say A and B are Simple
    tag for C and D are Rare

    For the Back end already works prefect since no specific requirement, but
    in the front end, due to client request, i need to hide the product A (either by view to Product Page or Search). Now the condition is when i use your plug in to searching by tag with keyword ‘Simple’ will return A and B while I only expect B come out.

    Do you have solutions for this case? Thank you very much

    1. For searching visibility woocommerce has some options built in that the plugin will respect for limiting visibility to the search / catalog etc.

      You case sounds pretty specific but you could modify the plugin to build the SQL query dynamically and exclude the visibility join if the user is logged in to the admin site. is_admin() should do the trick.

  8. hey there!
    i like your plugin.
    is there a way to deploy the tag-search in the Orders section of Woo?
    i have all my tags setup and can run a search in the “products” table.
    but i woudl REAAALLY love to be able to run that same search on the orders table – for orders of all statuses:

    pending
    on hold
    completed
    cancelled

    does your plugin currently have this capacity? if not, how complex would it be to deploy this?

    my reason is that i have multiple vendors and they don;t want to have to run an individual search by product – instead i have their vendor names as tags and they could just input that 1x and get the orders that have come in for them…

    thanks!!

  9. Hi Matt,

    Thanks for this awesome plugin. It works to an extent, but there is a tiny bug that I found. When a product has tags like [report, report cover, report design] and when I search for ‘report’, the product shows up 3 times in the results page because the word appeared 3 times in the tags. How can we fix this?
    Woocommerce Version: 2.0.18
    Thanks!

  10. This is an awesome plugin, thanks really a lot.
    Well … It actually duplicates the results based on tags.
    I got the product “X” with tags “credenza” and “credenzas”
    If i seach “credenza” i got the same product but twice in search results.
    If i seach “credenzas” i got only one result.
    So i have to check my tags, is not a plugin fail or something.

    BUT…
    With the plugin activated (it really solve my search problems)
    I got so many duplicated in woocommerce ON-SALE widget ….
    With the search-for-products-by-tag deactivated the widget works normally … so it is a plugin “interferance”
    Can you help me please? Thanks a lot !!!

  11. The search plugin works well, however the search results are also added into the widgets in my sidebar and footer (woo’ shopping cart and woo’ recent products). Has anyone else got this problem and how can I fix it? Thanks for any help!

    1. Hmm I haven’t seen that before. I am putting some notes together for a version 0.6 I will add this to the list.

      Thanks

  12. Hi,

    I just came accross this nice little plugin. Good Job! Some of my products have size attributes like 17.5R22 which don’t seem to show up in the search results. Do you have any idea why not? Is it the special char? thanks :)

    1. Hi Rob I will take a look at this, the plugin splits tags to search for by spaces. What is the special character you are using? Maybe wordpress comments are filtering it out.

  13. Hey Matthew,

    This search plugin is awesome, but I was wondering if it could be modified to search only one category, or only tags. Nice if you need a global search, but I need a more focused search in my case. Thanks so much.

    -Will

    1. Thanks! I am considering a more widgety version of this plugin with a little more functionality combining both of my search plugins and extra UI for filtering categories etc.

    1. I have tested an recently released version 0.3. Was it duplicity problems you were having? If so it is now fixed in the latest version.

  14. I just wanted to say that you are awesome for creating this. I searched for a while and broke my site once until I came across yours.

    Your time + your effort is incredibly appreciated.

    1. One question, however!

      Is there a way to modify the results so that the newest products are at the top instead of bottom when searching for a tag?

      1. Thats V,I need to do an update shortly that will make it play nicer with the woocommerce search filters. That should fix your problem

  15. Hi Matty, This is plugin is extremely useful! I’m trying to make as much use of the item tagging as possible and it’s a bit of a surprise to find original search doesn’t do this by default. I have a couple of suggestions to make. Is it possible to either make partial matches (or more simply take plurals into account with your plugin)?

    If I seach for ‘helicopters’ in a toyshop and the item is tagged with ‘helicopter’ the seach will not return a result. Also if someone types ‘toy helicopter’ into the search, this also will return no result despite it being tagged with ‘helicopter’. Is it possible to return results for these non-exact matches ?

    Alternatively, adding & subtracting a trailing ‘s’ from each seach may double the queries, but should similarly return more matches. Thanks !

    1. Hey thank for the feedback. A previous commenter suggested doing the search splitting terms on spaces rather than commas which would address your second problem, I will have a think about your plural suggestion too. Thanks

  16. Hello Matthew,
    Thank you for a great plugin. I’m still tinkering with it, but had a question. I tested another similar plugin and found that yours does allow for multiple tags in the search, but separated with a comma (the other plugin fails). Is it possible to add the ability to ignore a space if they don’t use a comma and still do a successful search?
    eg.
    Search: 2010, partnumber
    and/or
    Search: 2010 partnumber

    The reason being, not all users pay attention to the use ‘,’ notes and anticipating that would be great.

    1. Hey, I will investigate next time I make an update. It makes it quite tricky to decide what to search for when splitting tags on space as tags themselves can have spaces in them

  17. Hi Matt,
    I sell auto parts. Until this week these were sold the old fashioned way, bricks and mortar. I am experimenting with a specific market, sport rotors, drilled and slotted.
    In the auto parts (spares in your part of the world) market, parts are generally searched by Make, Model, Year, Engine type. Parts are usually categorized by their function. For example, some categories would be Filters and sub categories would be oil, air fuel cabin. In my case it would be Brake Products/rotors/brake pads/ brake hardware.
    In my Product page I added categories for Make, Model, year, sku, etc. I just discovered that I can search by sku, thanks to you. Can you expand it, allowing us to enter a customizable field that can be searched?
    Imagine the possibilities.
    Thanks.

  18. Hi,

    I am unable to use this product due to the userguide or lack of any short codes so that i could come to know how to use this. Please help in this regard.

    Thanks

    1. Hi Ahmed, there is no config, just install and activate. It manipulates the results from a normal product search in the admin or your site

  19. Thank you for this awesome plugin!! It was just what client’s site needed. However, when you search by a tag a picture of the product doesn’t show. Is there a way I can fix this?
    Thank you!

  20. Greetings!

    Thanks for this great snippet.

    I have a problem though. I get duplicate products when a product tag is on a product that exists in more than one category. The same product is showing again and again depending on the number of categories a product is in.

    Is there any way I can fix that?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>