Batch expiry date shortcode

WooCommerce Batch Numbers comes with a useful shortcode to place the Expiry Date in your product pages, where you have access to the product object. You can also define a time interval from where the date will be showed and hided.

Setting up the shortcode #

  • show_days_before_expiry=”” accepts a number. Ex: 60
  • hide_days_before_expiry=”” accepts a number. Ex: 30

Simple shortcode with default attributes:

[wcpbn_product_next_batch_expiry_date]

Shortcode with all atts customized:

[wcpbn_product_next_batch_expiry_date show_days_before_expiry="60" hide_days_before_expiry="30"]

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