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.

It’s possible to change the default date format under the WordPress General Settings:

If you require a different format from the default settings, it’s possible to change that using a specific filter from our plugin called wpo_wcpbn_format_date.

Using the filter hook #

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

add_filter( 'wpo_wcpbn_format_date', 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