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.

Setting up the shortcode #

  • show_expiry_date=”” accepts ‘yes’

Simple shortcode with default attributes:


Shortcode with all atts customized:

[wcpbn_product_batch_numbers show_expiry_date="yes"]

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]'); ?>