I have created a custom taxonomy called "job_orders" to a products in woocommerce. I want to edit cart page and show then terms of job_orders inside cart table. currently I'm using the below script which echo all the terms , I want to show only the categories select in back end.I appreciate if anybody can help on this.

$terms = get_terms('job_orders','hide-empty=0&orderby=id');
//shuffle($terms);   // dlete this line if you don't want it random.
$sep = '';
foreach ( $terms as $term ) {
    if( ++$count > 60 ) break;   // number of tags here.
    //echo $sep . ''.$term->name.'';
    echo $sep . $term->name;
    $sep = ', ';  // Put your separator here.

Above goes inside below woocommerce loop in cart.php

foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {

1 Answer 1


found the code that do the trick

$terms = get_the_terms( $product_id, 'my_taxo' );
foreach ($terms as $term) {
$product_cat = $term->name;
echo $product_cat ;

from below discussion https://stackoverflow.com/questions/33495716/get-the-product-categories-and-display-it-on-cart-page-woocommerce Thanks for the authors

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.