Automattic\WooCommerce\Blocks\Utils
CartCheckoutUtils::is_cart_block_default()
Checks if the default cart page is using the Cart block.
Метод класса: CartCheckoutUtils{}
Хуков нет.
Возвращает
true|false
. true if the WC cart page is using the Cart block.
Использование
$result = CartCheckoutUtils::is_cart_block_default();
Код CartCheckoutUtils::is_cart_block_default() CartCheckoutUtils::is cart block default WC 9.4.2
public static function is_cart_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( 'cart' ), 'wp_template' ); foreach ( $templates_from_db as $template ) { if ( has_block( 'woocommerce/cart', $template->content ) ) { return true; } } } $cart_page_id = wc_get_page_id( 'cart' ); return $cart_page_id && has_block( 'woocommerce/cart', $cart_page_id ); }