[Solved] Display Categories Assigned to a WooCommerce Product


I have solved the issue with creating a list with

http://codex.wordpress.org/Template_Tags/wp_list_categories

changing style to list, then style it with CSS to my needs 🙂

<?php 

    $taxonomy = 'product_cat';

    // get the term IDs assigned to post.
    $post_terms = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );

    if ( !empty( $post_terms ) && !is_wp_error( $post_terms ) ) {

        $term_ids = implode( ',' , $post_terms );

        $tophelp_categories = wp_list_categories( 'title_li=<span class="posted_in">Kategóriák:</span>&style=list&echo=0&depth=0&taxonomy=' . $taxonomy . '&include=" . $term_ids );

        // display post categories
        echo ($tophelp_categories);
    }

?>

0

solved Display Categories Assigned to a WooCommerce Product