How to Display Categories at cart page – Woocommerce
are you find about How to Display Categories at cart page?
Category is display at archive page that showing the list of products or post.
What is Archive page?
Archive page is special page that showing all of your post or product at one place from specific categories or based on filter.
on the Default Woocommerce cart page [ When at least Product in cart ] showing Product name, Product Price, Product Quantity for simple product.
For variable product additionally After product name showing variation name. let see in article
Normally Showing cart page like below image

here I will share the code for showing the category name below product title on cart page. follow me for achieve the goal
Go to your active child theme or parent theme and open functions.php file and paste below code.
/* show category on cart page hrtechpro.in */
add_filter( 'woocommerce_cart_item_name', 'hrtechpro_show_category_on_cart', 9999, 3 );
function hrtechpro_show_category_on_cart( $name, $cart_item, $cart_item_key ) {
$product = $cart_item['data'];
if ( $product->is_type( 'variation' ) ) {
$product = wc_get_product( $product->get_parent_id() );
}
$cat_ids = $product->get_category_ids();
if ( $cat_ids ) $name .= '<br>' . wc_get_product_category_list( $product->get_id(), ', ', '<span class="posted_in">' . _n( 'Category:', 'Categories:', count( $cat_ids ), 'woocommerce' ) . ' ', '</span>' );
return $name;
}
/* show category on cart page over hrtechpro.in */
once you paste the above code inside your functions.php file and just save and go to the cart page.
Now cart page showing the category name below the product title like below image

If you have any query please comment in below comment section, we have ping back for the same as soon as possible.
This is all about How to Display Categories at cart page.
If you have any suggestion or idea to improve us, please make comment below on comment section, always welcome your suggestions.
If this article found you useful share it to those who are in need of this.
Sharing is caring.