Last active
January 19, 2018 17:27
-
-
Save grola/bfe439d8845ac8a2e884121a5a7f1773 to your computer and use it in GitHub Desktop.
Leading zeros in WooCommerce order number
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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