Skip to content

Instantly share code, notes, and snippets.

Last active Jan 19, 2018
What would you like to do?
Leading zeros in WooCommerce order number
add_filter( 'woocommerce_order_number', 'swp_woocommerce_order_number_leading_zeros', 10 );
function swp_woocommerce_order_number_leading_zeros( $order_id ) {
$max_length = 8;
$new_order_id = str_pad( $order_id, $max_length, '0', STR_PAD_LEFT );
return $new_order_id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment