Add product variation ID to invoice

Hi @lfedele

To show the product variation ID within the invoice product details in our invoice, please add the below code in your active theme’s functions.php file or use a plugin like Code Snippets:

function add_product_variation_id( $product_name, $item ) {
	$product_id    = $item['product_id'];
	$product_variation_id = $item['variation_id'];
	$product_instance = $item['variation_id'];
	if ($product_instance == 0) {
	echo  $product_name;
	}else {
	echo '<br>' . $product_instance; // variation Id .
	echo  $product_name;
} add_filter('wcdn_order_item_name','add_product_variation_id', 10, 2 );

Please let us know if you have any other query.

Regards, Moksha.

Hi @mokshasharmila13,

that’s great, thank you so much for your quick help!


This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer