Add Prefix And Suffix to Order Number With Date Serial For WooCommerce

目錄

Original Post

Add Prefix And Suffix to Order Number With Date Serial For WooCommerce


//--- Add Order Number Prefix and Suffix ---//
function change_woocommerce_order_number( $order_id ) {
	$order = new WC_Order($order_id);
	$datetime = new DateTime($order->order_date);
	$date = $datetime->format('Y-m-d');
	$dateSerial = explode("-", $date);
	$suffix = "anything";
  $new_order_id = $dateSerial[0].$dateSerial[1].$dateSerial[2].$order_id.$suffix;
  return $new_order_id;
}
add_filter( 'woocommerce_order_number', 'change_woocommerce_order_number' );

Related Posts

The Complete WordPress Customization Tutorial – Just Copy And Paste And Work

Content Protection by DMCA.com
A
Aron

Leave a Reply

Your email address will not be published. Required fields are marked *