wcdn_order_number

The WooCommerce Print Invoices & Delivery Notes wcdn order number function.

Description

wcdn_order_number(); 

Usage

  1. if ( !function_exists( 'wcdn_order_number' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-print-invoices-delivery-notes/woocommerce-delivery-notes-print.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wcdn_order_number(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/woocommerce-delivery-notes-print.php  
  1. function wcdn_order_number() { 
  2. global $wcdn; 
  3. $before = trim( $wcdn->print->get_setting( 'before_order_number' ) ); 
  4. $after = trim( $wcdn->print->get_setting( 'after_order_number' ) ); 
  5. $offset = trim( $wcdn->print->get_setting( 'order_number_offset' ) ); 
  6.  
  7. // get custom order number as provided by the plugin 
  8. // http://wordpress.org/extend/plugins/woocommerce-sequential-order-numbers/ 
  9. // if custom order number is zero, fall back to ID 
  10. $order_id = $wcdn->print->order_id; 
  11.  
  12. if ( !empty( $wcdn->print->get_order()->order_custom_fields['_order_number'] ) ) { 
  13. $order_id = $wcdn->print->get_order()->order_custom_fields['_order_number'][0]; 
  14.  
  15. $number = $before . ( intval( $offset ) + intval( $order_id ) ) . $after; 
  16. return $number;