×

 

Home Contact Us Payments SC Commerce SC Commerce Docs SC Commerce Snippets

Simply Computing

We make websites. Simple.

Extend SC Commerce order number

SC 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 SC Commerce order number
 */

add_filter('woocommerce_order_number', 'sc_woo_extend_classic_commerce_order_number');

function sc_woo_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