Change the date format

Table of Contents

WooCommerce Batch Numbers uses the default WooCommerce date format by calling the function wc_date_format(). This function grabs the default WordPress saved option date_format from the options database table.

But now it’s possible to set the default date format under the plugin options:

Or using a specific filter from our plugin called wpo_wcpbn_date_format.

Using the filter hook #

You just need to place the code snippet below inside your theme functions.php file:

add_filter( 'wpo_wcpbn_date_format', function ($format) { return 'd.m.Y'; } );

You can replace the 'd.m.Y' with any other format, eg. 'd/m/Y' or 'Y-m-d'.

If you never worked with filters, please check our documentation page: How to use filters