Hi,
It depends where you want to display it
But what I can propose it is to use a simpler solution. Edit the email and replace
<?php if ($config->get('show_code')) { $colspan++; ?>
<td style="font-weight:bold;"><?php echo JText::_('CART_PRODUCT_CODE'); ?></td>
<?php } ?>
By
<?php $colspan++; ?>
<td style="font-weight:bold;"><?php echo JText::_('CART_PRODUCT_CODE'); ?></td>
And
<?php if ($config->get('show_code')) { ?>
<td><p class="hikashop_product_code_mail"><?php echo $item->order_product_code; ?></p></td>
<?php } ?>
By
<td><p class="hikashop_product_code_mail"><?php echo $item->order_product_code; ?></p></td>
And it will display the product code.
My example is for the mail "order_status_notification".
You can also change the HikaShop configuration "show product code" in order to display the code (in the website and in the emails).
Regards,