add_filter( 'woocommerce_order_number', 'change_woocommerce_order_number', 1, 2);
function change_woocommerce_order_number( $order_id, $order ) {
$prefix = '#SAM-';
$suffix = '-' . date(Y);
// You can use either one of $order->id (or) $order_id
// Both will work
return $prefix . sprintf("%02d", $order->id) . $suffix;
}
Adding suffix and prefix to WooCommerce order number without using a plugin
Categorised in: Tổng hợp
You can try str_pad($month, 2, ‘0’, STR_PAD_LEFT);
Hello, I enjoy reading through your article post. I wanted
to write a little comment to support you.