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.
Simple shortcode with default attributes:
Shortcode with all atts customized:
[wcpbn_product_next_batch_expiry_date show_days_before_expiry="60" hide_days_before_expiry="30"]
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]'); ?>