Automattic\WooCommerce\Blocks\Utils

CartCheckoutUtils::is_checkout_block_default()public staticWC 1.0

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

Method of the class: CartCheckoutUtils{}

No Hooks.

Return

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

Usage

$result = CartCheckoutUtils::is_checkout_block_default();

CartCheckoutUtils::is_checkout_block_default() code WC 9.4.2

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 );
}