wc_paying_customer

Order Status completed - This is a paying customer.

Description

wc_paying_customer( (int) $order_id ); 

Parameters (1)

0. $order_id (int)
The order id.

Usage

  1. if ( !function_exists( 'wc_paying_customer' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-user-functions.php'; 
  3.  
  4. // The order id. 
  5. $order_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wc_paying_customer($order_id); 
  9.  

Defined (1)

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

/includes/wc-user-functions.php  
  1. function wc_paying_customer( $order_id ) { 
  2. $order = wc_get_order( $order_id ); 
  3. $customer_id = $order->get_customer_id(); 
  4.  
  5. if ( $customer_id > 0 && 'shop_order_refund' !== $order->get_type() ) { 
  6. $customer = new WC_Customer( $customer_id ); 
  7. $customer->set_is_paying_customer( true ); 
  8. $customer->save();