Table of Contents
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’
- show_quantity=”” accepts ‘yes’
- limit=”” accepts ‘number’
Simple shortcode with default attributes:
[wcpbn_product_batch_numbers]
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]'); ?>