WooCommerce Batch Numbers comes with a useful shortcode to display the Batch number in your product pages, where you have access to the product object.
Simple shortcode with default attributes:
Shortcode with all atts customized:
If you’re working directly in template files, you can also use this PHP code:
<?php echo do_shortcode('[wcpbn_product_batch_numbers]'); ?>