WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана


CreateAccount::from_order_request() public WC 1.0

Create a user account for specified order and request (if necessary). If a new account is created:

  • The order is associated with the account.
  • The user is logged in.

{} Это метод класса: CreateAccount{}

Хуков нет.


Число. The new user id, or 0 if no user was created.


$CreateAccount = new CreateAccount();
$CreateAccount->from_order_request( \WC_Order $order, \WP_REST_Request $request );
$order(\WC_Order) (обязательный)
The order currently being processed.
$request(\WP_REST_Request) (обязательный)
The current request object being handled.

Код CreateAccount::from_order_request() WC 4.7.1

public function from_order_request( \WC_Order $order, \WP_REST_Request $request ) {
	if ( ! self::is_feature_enabled() || ! $this->should_create_customer_account( $request ) ) {
		return 0;

	$customer_id = $this->create_customer_account(

	// Log the customer in and associate with the order.
	wc_set_customer_auth_cookie( $customer_id );
	$order->set_customer_id( get_current_user_id() );

	return $customer_id;