I changed the product cards to also show the category and short description of the product but I can't show it in up-sell products. this is the code i used
function category_single_product(){
$product_cats = wp_get_post_terms( get_the_ID(), 'product_cat' );
if ( $product_cats && ! is_wp_error ( $product_cats ) ){
$single_cat = array_shift( $product_cats ); ?>
<p itemprop="name" class="card product_category_title"><span><?php echo $single_cat->name; ?></span></p>
<?php }
}
add_action( 'woocommerce_before_shop_loop_item_title', 'category_single_product', 25 );
/**
* Add the product's short description (excerpt) to the WooCommerce shop/category pages.
*/
function woocommerce_after_shop_loop_item_title_short_description() {
global $product;
if ( ! $product->get_short_description() ) return; ?>
<div itemprop="description">
<?php echo apply_filters( 'woocommerce_short_description', $product->get_short_description() ) ?>
</div>
<?php
}
add_action('woocommerce_after_shop_loop_item_title', 'woocommerce_after_shop_loop_item_title_short_description', 5);
How can you do to have the same information also in the up-sell card. I use Wordpress with Divi theme and I noticed that in the page editor the up-sell products code works and shows the description and category but then they are not seen in the frontend.