wpc_post_order

The WordPress Core wpc post order function.

Description

wpc_post_order( $order_id, (string) $refund_id = '' ); 

Parameters (2)

0. $order_id
The order id.
1. $refund_id — Optional. (string) => ''
The refund id.

Usage

  1. if ( !function_exists( 'wpc_post_order' ) ) { 
  2. require_once '/woocommerce-putler-connector.php'; 
  3.  
  4. // The order id. 
  5. $order_id = null; 
  6.  
  7. // The refund id. 
  8. $refund_id = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = wpc_post_order($order_id, $refund_id); 
  12.  

Defined (1)

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

/woocommerce-putler-connector.php  
  1. function wpc_post_order( $order_id, $refund_id = '' ) { 
  2.  
  3. $post_type = get_post_type( $order_id ); 
  4. $valid_post_type = array("shop_order", "shop_subscription", "scheduled-action"); 
  5.  
  6. if ( empty($post_type) || in_array($post_type, $valid_post_type) === FALSE ) { 
  7. return; 
  8.  
  9. if( $post_type != 'shop_order' ) { //code for getting subscription details 
  10. $params = array('sub_id' => $order_id, 'sub_details' => (array) get_post($order_id)); 
  11. } else { 
  12. $params = array('order_id' => $order_id, 'refund_id' => $refund_id); 
  13.  
  14. $action = ( !empty($_REQUEST['action']) ) ? $_REQUEST['action'] : ''; 
  15.  
  16. if ( !empty($action) && $action == 'trash' ) { //flag for handling trashed orders 
  17. $params[$action] = 1; 
  18.  
  19.  
  20. wpc_init(); 
  21. if (method_exists($GLOBALS['putler_connector'], 'post_order') ) { 
  22. $GLOBALS['putler_connector']->post_order( $params );