Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
WC_Tracker::get_blocks_from_page( string $block_name, string $woo_page_name )
Get all instances of the specified block on a specific woo page (e.g. cart
or checkout
page).
Description Description
Parameters Parameters
- $block_name
-
(Required) The name (id) of a block, e.g.
woocommerce/cart
. - $woo_page_name
-
(Required) The woo page to search, e.g.
cart
.
Return Return
(array) Array of blocks as returned by parse_blocks().
Source Source
File: includes/class-wc-tracker.php
private static function get_blocks_from_page( $block_name, $woo_page_name ) { $page_blocks = self::get_all_blocks_from_page( $woo_page_name ); // Get any instances of the specified block. return array_values( array_filter( $page_blocks, function ( $block ) use ( $block_name ) { return ( $block_name === $block['blockName'] ); } ) ); }