Answer the question
In order to leave comments, you need to log in
How to add product category name to woocommerce card?
Hello ! I don't know much woocommerce, but the order needs to be closed. I don't know how to add product category output to the card. I have not yet dealt with the "shortcuts" new and sale, but in advance it would be nice to hint at the correct implementation. I hope everyone will be understanding. Thank you)
Answer the question
In order to leave comments, you need to log in
Discount out of the box, the category is lower, perhaps a different priority, the inscription New needs to be understood on what it depends, there doesn’t seem to be such a box, then a custom field
add_action( 'woocommerce_before_shop_loop_item_title', 'custom_show_product_cat', 30 );
function custom_show_product_cat() {
global $product;
echo wc_get_product_category_list( $product->get_id(), ', ', '<div class="product-cat">' . _n( 'Category:', 'Categories:', count( $product->get_category_ids() ), 'woocommerce' ) . ' ', '</div>' );
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question