Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Woocommerce Short_Description in Details Order

I'm creating my new website with Wordpress and Woocommerce. I would like to display the short description in the order detail.

I found this code :

add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_single_excerpt', 5);

But that shows me the description in home.

Is there a way to make it appear in the order detail?

like image 337
Visucio2 Avatar asked Feb 01 '26 04:02

Visucio2


1 Answers

It can be done with a custom unction hooked in woocommerce_order_item_name filter hook, this way:

add_filter( 'woocommerce_order_item_name', 'add_single_excerpt_to_order_item', 10, 3 );
function add_single_excerpt_to_order_item( $item_name, $item, $is_visible ){
    $product_id = $item->get_product_id(); // Get the product Id
    $excerpt = get_the_excerpt( $product_id ); // Get the short description

    return $item_name . '<br><p class="item-description">' . $excerpt ; '</p>';
}

This code goes in function.php file of your active child theme (or theme) or also in any plugin file.

Tested and works. It will display the short description in Order items below the item name.

like image 64
LoicTheAztec Avatar answered Feb 02 '26 18:02

LoicTheAztec