woocommerce_checkout_registration_required хук-фильтрWC 3.0.0

Controls if registration is required in order for checkout to be completed.

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

add_filter( 'woocommerce_checkout_registration_required', 'wp_kama_woocommerce_checkout_registration_required_filter' );

/**
 * Function for `woocommerce_checkout_registration_required` filter-hook.
 * 
 * @param bool $checkout_registration_required If customers must be registered to checkout.
 *
 * @return bool
 */
function wp_kama_woocommerce_checkout_registration_required_filter( $checkout_registration_required ){

	// filter...
	return $checkout_registration_required;
}
$checkout_registration_required(true|false)
If customers must be registered to checkout.

Список изменений

С версии 3.0.0 Введена.

Где вызывается хук

WC_Checkout::is_registration_required()
woocommerce_checkout_registration_required
woocommerce/includes/class-wc-checkout.php 202
return apply_filters( 'woocommerce_checkout_registration_required', 'yes' !== get_option( 'woocommerce_enable_guest_checkout' ) );

Где используется хук в WooCommerce

woocommerce/includes/class-wc-checkout.php 116
remove_filter( 'woocommerce_checkout_registration_required', '__return_true', 0 );
woocommerce/includes/class-wc-checkout.php 117
remove_filter( 'woocommerce_checkout_registration_required', '__return_false', 0 );
woocommerce/includes/class-wc-checkout.php 118
add_filter( 'woocommerce_checkout_registration_required', $bool_value ? '__return_false' : '__return_true', 0 );