Check if the current page is a WooCommerce block checkout

/**
 * Checks if the current page is a WooCommerce *block* checkout.
 *
 * @see https://wpcodebook.com/woocommerce-check-current-page-block-checkout/
 */
function wpcodebook_is_wc_block_checkout() {
	return WC_Blocks_Utils::has_block_in_page( 
		get_the_ID(),
		'woocommerce/checkout'
	);
}

Leave a Comment