WordPress at a glance
function is not described

Automattic\WooCommerce\Admin\API\Reports\Customers

DataStore::get_or_create_customer_from_order() public WC 1.0

Get or create a customer from a given order.

{} It's a method of the class: DataStore{}

Hooks from the method
Return

Int|true|false. Nothing.

Usage

$result = DataStore::get_or_create_customer_from_order( $order );
$order(object) (required)
WC Order.

Code of DataStore::get_or_create_customer_from_order() WC 5.3.0

<?php
public static function get_or_create_customer_from_order( $order ) {
	if ( ! $order ) {
		return false;
	}

	global $wpdb;

	if ( ! is_a( $order, 'WC_Order' ) ) {
		return false;
	}

	$returning_customer_id = self::get_existing_customer_id_from_order( $order );

	if ( $returning_customer_id ) {
		return $returning_customer_id;
	}

	list($data, $format) = self::get_customer_order_data_and_format( $order );

	$result      = $wpdb->insert( self::get_db_table_name(), $data, $format );
	$customer_id = $wpdb->insert_id;

	/**
	 * Fires when a new report customer is created.
	 *
	 * @param int $customer_id Customer ID.
	 */
	do_action( 'woocommerce_analytics_new_customer', $customer_id );

	return $result ? $customer_id : false;
}