Listing WooCommerce products by tags

This may not be a frequent request, but few months ago I had a client who wanted to list WooCommerce products by tags assigned to each product. There was no official plugin available (there still isn’t, from what I can tell), but a quick googling brought me to solution created by Remi Corson, WooThemes developer. The solution is very simple, it is actually a shortcode, and below you will find my forked version in which I only added few more shortcode parameters. You can download it from Gist, or you can download the zip file file below the code and install it into your website as a regular plugin. Copyrights go to plugin author.

Download plugin.

  • Thanks, these are exactly the improvements needed to the original plugin. One problem I’m having is that the page controls don’t appear so there is no way to page beyond the initial 12 products (or however many are set via the shortcode). Can you advise a fix, or is this likely to be a theme problem (Divi in my case)?

    • Dubem Nriagu

      PLease, have you been able to solve this?

      • I don’t believe I did but unfortunately I am no longer running that site. Sorry I can’t be more helpful.

  • Kristian Øllgaard

    Perfect, had problems with Remi’s original code, but your code works. Thanks for sharing!

    • My pleasure 🙂

      • Igi Malek

        Many thanks for the plugin. the withdrawal of goods works.
        Suggest how to sort?
        Changes to ‘orderby’ => ‘title’ do not work. the order remains the same.

  • Thanks Bruno. Your code works. One question. How can you sort the products by price low to high?

  • Jeremia

    Awesome improvement on Remi’s plugin!

    For some reason I can’t seem to get it to sort by title, it only seems to sort them by ID.

    Have any idea why this might be?

    Thanks! 🙂

  • Lina

    Great code, thank you! I would like to use it on single product page and would like to exclude the current product from the results. Could you please help me how to edit the code to achieve this? Many thanks in advance!

    • Lina

      I added
      ‘post__not_in’ => array (get_the_ID()),
      to the query arguments and it seems to work. Is this a proper solution?

  • Usama Saeed

    Thanks, great plugin to work with.
    Did we sort products by tags on edit order page via this plugin?

  • Alistair Gene Tiu Yap


  • Ed Doyle

    I have an issue coming up on the page with the shortcode.

    “Notice: Undefined variable: operator in E:offalyhistorydevelopmenthtdocsWPwp-contentpluginstest_woocommerce_by_tagswoocommerce_by_tags.php on line 53”

    I do not know how to get rid of this notice.