Automattic\WooCommerce\Admin\API\Reports\Orders\Stats
DataStore::set_customer_first_order
Set a customer's first order and all others to returning.
Method of the class: DataStore{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = DataStore::set_customer_first_order( $customer_id, $order_id );
- $customer_id(int) (required)
- Customer ID.
- $order_id(int) (required)
- Order ID.
DataStore::set_customer_first_order() DataStore::set customer first order code WC 11.1.0
protected static function set_customer_first_order( $customer_id, $order_id ) {
global $wpdb;
$orders_stats_table = self::get_db_table_name();
$wpdb->query(
$wpdb->prepare(
'UPDATE %i SET returning_customer = CASE WHEN order_id = %d THEN false ELSE true END WHERE customer_id = %d',
$orders_stats_table,
$order_id,
$customer_id
)
);
}