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 );