wc_correios_get_tracking_codes

Get tracking codes.

Description

(array) wc_correios_get_tracking_codes( (WC_Order|int) $order_id ); 

Returns (array)

Parameters (1)

0. $order_id (WC_Order|int)
Order ID or order data.

Usage

  1. if ( !function_exists( 'wc_correios_get_tracking_codes' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-correios/includes/wc-correios-functions.php'; 
  3.  
  4. // Order ID or order data. 
  5. $order_id = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wc_correios_get_tracking_codes($order_id); 
  9.  

Defined (1)

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

/includes/wc-correios-functions.php  
  1. function wc_correios_get_tracking_codes( $order_id ) { 
  2. $order = wc_get_order( $order_id ); 
  3.  
  4. if ( method_exists( $order, 'get_meta' ) ) { 
  5. $codes = $order->get_meta( '_correios_tracking_code' ); 
  6. } else { 
  7. $codes = $order->correios_tracking_code; 
  8.  
  9. return array_filter( explode( ', ', $codes ) );