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

Automattic\WooCommerce\Blocks\Domain\Services

CreateAccount::should_create_customer_account() protected WC 1.0

Check request options and store (shop) config to determine if a user account should be created as part of order processing.

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

Хуков нет.

Возвращает

true|false. True if a new user account should be created.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->should_create_customer_account( $request );
$request(WP_REST_Request) (обязательный)
The current request object being handled.

Код CreateAccount::should_create_customer_account() WC 5.5.2

<?php
protected function should_create_customer_account( \WP_REST_Request $request ) {
	if ( is_user_logged_in() ) {
		// User is already logged in - no need to create an account.
		return false;
	}

	// From here we know that the shopper is not logged in.
	// check for whether account creation is enabled at the global level.
	$checkout = WC()->checkout();
	if ( ! $checkout instanceof \WC_Checkout ) {
		// If checkout class is not available, we have major problems, don't create account.
		return false;
	}

	if ( false === filter_var( $checkout->is_registration_enabled(), FILTER_VALIDATE_BOOLEAN ) ) {
		// Registration is not enabled for the store, so return false.
		return false;
	}

	if ( true === filter_var( $checkout->is_registration_required(), FILTER_VALIDATE_BOOLEAN ) ) {
		// Store requires an account for all checkouts (purchases).
		// Create an account independent of shopper option in $request.
		// Note - checkbox is not displayed to shopper in this case.
		return true;
	}

	// From here we know that the store allows guest checkout;
	// shopper can choose whether they sign up (`should_create_account`).

	if ( true === filter_var( $request['should_create_account'], FILTER_VALIDATE_BOOLEAN ) ) {
		// User has requested an account as part of checkout processing.
		return true;
	}

	return false;
}