Answer the question
In order to leave comments, you need to log in
How to display the categories of goods that are in this brand?
It does not allow you to put a link in another way, so
on host1839650.hostland.pro/category/filtry/?filter_brand=alessi you need to display all categories that include products with this brand. How to implement it?
Here host1839650.hostland.pro/category/filtry/ subcategories come out. But how can you also make them appear in the brand?
Output with this code
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 '<div class="my-category"><div><ul class="woocommerce-categories">';
foreach ( $terms as $term ) {
echo '<li class="woocommerce-product-category-page">';
echo '<a href="' . esc_url( get_term_link( $term ) ) . '" class="' . $term->slug . '">';
woocommerce_subcategory_thumbnail( $term );
echo '</a>';
echo '<p>';
echo '<a href="' . esc_url( get_term_link( $term ) ) . '" class="' . $term->slug . '">';
echo $term->name;
echo '</a>';
echo '</p>';
echo '</li>';
}
echo '</ul></div></div>';
}
}
add_action( 'woocommerce_before_main_content', 'woocommerce_product_category', 100 );
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question