wpc_order_updated

The WooCommerce Putler Connector wpc order updated function.

Description

wpc_order_updated( $post_id ); 

Parameters (1)

0. $post_id
The post id.

Usage

  1. if ( !function_exists( 'wpc_order_updated' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-putler-connector/woocommerce-putler-connector.php'; 
  3.  
  4. // The post id. 
  5. $post_id = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wpc_order_updated($post_id); 
  9.  

Defined (1)

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

/woocommerce-putler-connector.php  
  1. function wpc_order_updated( $post_id ) { 
  2.  
  3. //Flag for woo2.2+ 
  4. $order_status_new = $_POST['order_status']; 
  5.  
  6. if (version_compare ( WOOCOMMERCE_VERSION, '2.2.0', '<' )) { 
  7. $order_status_old = get_the_terms( $post_id, 'shop_order_status'); 
  8. $order_status_old = $order_status_old[0]->slug; 
  9. } else { 
  10. $order_status_old = get_post_status( $post_id ); 
  11. if( $order_status_new == 'wc-refunded' ) { 
  12. return; 
  13. }  
  14.  
  15. if ( get_post_type( $post_id ) === 'shop_order' && $order_status_old == $order_status_new ) { 
  16. wpc_post_order($post_id);