Skip to content
Advertisement

WooCommerce – Add product Short Description to completed order email

I would like to have a product short description right under the product title in the completed-order email for customer. Thank you!

Advertisement

Answer

Try this:

// Show product description in email notifications
add_action( 'woocommerce_order_item_meta_end', 'woo_completed_order_email_notification', 10, 4 );

function woo_completed_order_email_notification( $item_id, $item, $order = null, $plain_text = false ){
    // Only on email notifications
    if( is_wc_endpoint_url() ) return;

    if ($order &&  $order->get_status() == 'completed' ) { // change status accordingly

        $product = wc_get_product( $item->get_product_id() );
        $short_desc = $product->get_short_description();

        
        if( ! empty($short_desc) ) {
            // Display the product description
            echo '<div class="product-description"><p>' . $short_desc . '</p></div>';
        }
    }
}
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement