WooCommerce Show Categories On Product Loop

WooCommerce show category on product card on loop


There are no pre-requisites in order for you to be able to implement this solution.

How To Implement This Solution?

Simply copy the pre-coded solution to your active theme’s functions.php or preferably the Code Snippets Plugin.

About this Solution

Being able to show which categories a product belongs to on the archive page make it clear to users that a product may belong to more than one category and also that there are more categories to navigate to. Allowing users to navigate to other categories from the product loop could help users find the products they are looking for more easily, reducing the time spent in the sales funnel. This quick guide shows you how you can display the categories that a product belongs to above the add to cart button on the product loop.

* Snippet Name:		Show categories on product loop.
* Snippet Author:	ecommercehints.com
function ecommercehints_woocommerce_after_shop_loop_item() {
$terms = the_terms( $post->ID, 'product_cat' );
    echo $terms;

// add the action
add_action( 'woocommerce_after_shop_loop_item', 'ecommercehints_woocommerce_after_shop_loop_item', 1, 0 );

Snippet Benefits

  • Allow customers to navigate between categories from the product loop.
  • Let customers know that a product may belong to more than one category from another category page.
WooCommerce Conversion Rate Optimisation (CRO) eBook
100 WooCommerce Conversion Rate Optimisation Tips

Leave a Reply

If you are going to write code in the comments, please wrap it between code tags.

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

Other Recent Guides

Subscribe To Emails

Get exclusive WooCommerce tips that I only share with email subscribers

Join hundreds of other subscribers