// ========================================================================= // DISPLAY PRODUCT CATEGORIES // ========================================================================= function woocommerce_product_category( $args = array() ) { $woocommerce_category_id = get_queried_object_id(); $args = array( 'parent' => $woocommerce_category_id ); $terms = get_terms( 'product_cat', $args ); if ( $terms ) { echo '<ul id="myFilter" class="woocommerce-categories">'; foreach ( $terms as $term ) { echo '<li class="woocommerce-product-category-page">'; echo '<a href="' . esc_url( get_term_link( $term ) ) . '" class="btn-filter ' . $term->slug . '">'; echo $term->name; echo '</a>'; echo '</li>'; } echo '</ul>'; } } add_action( 'woocommerce_archive_description', 'woocommerce_product_category', 10 );
Leave a Reply