A simple, powerful and independent e-commerce platform.
Sell anything with ease.

Extend Classic Commerce order number

Classic Commerce shared the order numbering with all other posts, so it is non-sequential and somewhat inflexible. There are ways to change this with plugins, but this code will allow you to simply add a prefix or a suffix to the number as it appears on the site and in emails. Note that the number is not changed in the database.

		/**
 * Extend Classic Commerce order number
 */

add_filter('woocommerce_order_number', 'cc_extend_classic_commerce_order_number');

function cc_extend_classic_commerce_order_number($order_id) {

  $prefix = 'CC-';
  $suffix = '/K';
  $new_order_id = $prefix . $order_id . $suffix;
  return $new_order_id;

}
	
View Raw Code ID: 91009