Product Archive

WooCommerce Show Categories On Product Loop

WooCommerce show category on product card on loop

Pre-Requisites

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.

100 WooCommerce Conversion Rate Optimisation Tips

This field is for validation purposes and should be left unchanged.

Let’s collaborate!

Need to outsource WordPress development?

Join forces with UnlimitedWP for an outsourced white label web development service you can truly rely on.

First Timer Here?

Sign up to receive 10% off on your first month with us.

26027
WELCOME OFFER