Skip to content

Instantly share code, notes, and snippets.

@grola
Last active January 19, 2018 17:27
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
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