Hi, I want to display the product category, I am trying with this code but I can’t get it.
add_action( ‘wpo_wcpdf_after_item_meta’, ‘wpo_wcpdf_show_product_cat’, 10, 3 );
function wpo_wcpdf_show_product_category ( $template_type, $item, $order ) {
if (empty($item[‘product’])) return;
$_product = $item[‘product’]->is_type( ‘cat’ ) ? wc_get_product_cat ( $item[‘product’]->get_parent_id() ) : $item[‘product’];
if ( method_exists( $_product, ‘get_product_cat’ ) ) {
$description = $_product->get_product_cat ();
printf(‘<div class=”product-cat”>%s</div>’, $cat );
}
}
Thank you