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.
Setting up the shortcode
- show_expiry_date=”” accepts ‘yes’
simple shortcode with default attributes:
shortcode with all atts customized:
Inserting the shortcode a php file
If you’re working directly in template files, you can also use this PHP code:
<?php echo do_shortcode('[wcpbn_product_batch_numbers]'); ?>