Automattic\WooCommerce\Blocks\Utils

CartCheckoutUtils::is_checkout_block_default()public staticWC 1.0

Checks if the default checkout page is using the Checkout block.

Метод класса: CartCheckoutUtils{}

Хуков нет.

Возвращает

true|false. true if the WC checkout page is using the Checkout block.

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

$result = CartCheckoutUtils::is_checkout_block_default();

Код CartCheckoutUtils::is_checkout_block_default() WC 9.6.1

public static function is_checkout_block_default() {
	if ( wc_current_theme_is_fse_theme() ) {
		// Ignore the pages and check the templates.
		$templates_from_db = BlockTemplateUtils::get_block_templates_from_db( array( 'checkout' ), 'wp_template' );
		foreach ( $templates_from_db as $template ) {
			if ( has_block( 'woocommerce/checkout', $template->content ) ) {
				return true;
			}
		}
	}
	$checkout_page_id = wc_get_page_id( 'checkout' );
	return $checkout_page_id && has_block( 'woocommerce/checkout', $checkout_page_id );
}