I'm using this basic loop to retrieve the category name:
$terms = get_the_terms( $product_id, 'product_cat' );
//var_dump ($terms);
if($items){
foreach ( $terms as $term ) {
//$cat_id = $term->id;
$cat_name = $term->name; //returns category name, but only in original language booking was made in.
}
}
}
I'm returning these results in a custom WooCommerce dashboard.php template, in order to display the client order history. The code works but it returns the category name ($cat_name) but not in the currently selected language, only in the language the booking was originally made in. The function I have tried to use is pll_get_term() but I am not sure of the best way of implementing it.
Thanks for looking.