Displaying product description

If you want to display the product description on the PDF invoice or packing slip, you can in two ways: by adding some code (an action) to your themes functions.php, or in a custom template (for full control over the exact position).

This is the most update proof option, because you don’t have to create a separate custom templates. You can either print this before or after the item meta, for more information, check out the list of PDF template action hooks.
Add this to your themes functions.php:

add_action( 'wpo_wcpdf_after_item_meta', 'wpo_wcpdf_show_product_description', 10, 3 );
function wpo_wcpdf_show_product_description ( $template_type, $item, $order ) {
	if (empty($item['product'])) return;
	global $wpo_wcpdf;
	printf('<div class="product-description">%s</div>', $item['product']->post->post_excerpt );
}

This displays the short description. To display the full description, replace post_excerpt with post_content in the code.

If you want to limit this to the packing slip:

add_action( 'wpo_wcpdf_after_item_meta', 'wpo_wcpdf_show_product_description', 10, 3 );
function wpo_wcpdf_show_product_description ( $template_type, $item, $order ) {
	if (empty($item['product'])) return;
	global $wpo_wcpdf;
	if ($template_type == 'packing-slip') {
		printf('<div class="product-description">%s</div>', $item['product']->post->post_excerpt );
	}
}

similarly, you can limit this to the invoice by replacing ‘packing-slip’ with ‘invoice’.

First, you need to create a custom template by following instructions here: Creating a custom PDF template.

Then place the following snippet where you would like the product description to appear. Note that this has to be in the order items table!

Short description:

<?php if (!empty($item['product'])) echo $item['product']->post->post_excerpt; ?>

Full description:

<?php if (!empty($item['product'])) echo $item['product']->post->post_content; ?>

To get the variation description, use

$item['product']->get_variation_description()

instead of

$item['product']->post->post_content

Important! It’s recommended to build in an extra check to see if the product is a variable product:

if (isset( $item['variation_id'] ) && $item['variation_id'] != 0) {
    if (!empty($item['product'])) echo $item['product']->get_variation_description();
}