Skip to content

Instantly share code, notes, and snippets.

@grola
Last active January 19, 2018 17:27
Show Gist options
  • Save grola/bfe439d8845ac8a2e884121a5a7f1773 to your computer and use it in GitHub Desktop.
Save grola/bfe439d8845ac8a2e884121a5a7f1773 to your computer and use it in GitHub Desktop.
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