Display Batch Number on Product pages with shortcode

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.

  • show_expiry_date=”” accepts ‘yes’

simple shortcode with default attributes:

[wcpbn_product_batch_numbers]

shortcode with all atts customized:

[wcpbn_product_batch_numbers show_expiry_date="yes"]

If you’re working directly in template files, you can also use this PHP code:

<?php echo do_shortcode('[wcpbn_product_batch_numbers]'); ?>