Support » Developing with WordPress » Adding classes to WP Woocommerce tags and categories

  • I have a Woocommerce store under construction that uses a combination of Categories and Tags. I want to be able to replace the Category and the Tag names with individual icons (ie one for each)..

    For example, we have ‘health’ and ‘babies’ categories and ‘local’ and ‘vegan’ tags.

    These list on the product as a name but I want to add an icon to each one. I can do this by CSS, but need to allocate a different class to each one.

    It doesn’t matter if the class name is the same as the name itself, so the ‘babies’ class can be babies and so on.

    I’ve looked for a plugin but there doesn’t seem to be anything and the only one I tried – Easy Category Icons by Templatic doesn’t appear to work (might be theme-dependant).

    I’m using OceanWP theme and Elementor page builder

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    Howdy!

    I’m not sure if you know but WooCommerce does add some additional classes. Many of which can be found here: https://plugins.trac.wordpress.org/browser/woocommerce/tags/3.5.7/includes/wc-template-functions.php

    It adds some taxonomy classes to the post and body. Not sure if that is what you meant though.

    Moderator bcworkz

    (@bcworkz)

    Adding to what Jose said, whether there’s a taxonomy term class you can use as CSS selectors depends on where you want to utilize the class to show a particular icon. At least in all the product listings I checked, the individual product’s outer post wrapper div has product category term classes like product_cat-{$term_slug} and product tag term classes like product_tag-{$term_slug}.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.