Answers for "display product categories shoploop"

0

display product categories shoploop

/**
 * @snippet       WooCommerce Show Product Categories
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 5.1
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */
 
add_action( 'woocommerce_after_shop_loop_item_title', 'bbloomer_show_all_subcats', 2 );
 
function bbloomer_show_all_subcats() {
   global $product;
   $cats = get_the_terms( $product->get_id(), 'product_cat' );
   if ( empty( $cats ) ) return;
   echo join( ', ', wp_list_pluck( $cats, 'name' ) );
}
Posted by: Guest on August-03-2021

Code answers related to "display product categories shoploop"

Browse Popular Code Answers by Language