WC_Blocks_Utils::get_all_blocks_from_page()
Get blocks from a woocommerce page.
Method of the class: WC_Blocks_Utils{}
No Hooks.
Return
Array
. Array of blocks as returned by parse_blocks().
Usage
$result = WC_Blocks_Utils::get_all_blocks_from_page( $woo_page_name );
- $woo_page_name(string) (required)
- A woocommerce page e.g. checkout or cart.
WC_Blocks_Utils::get_all_blocks_from_page() WC Blocks Utils::get all blocks from page code WC 7.7.0
private static function get_all_blocks_from_page( $woo_page_name ) { $page_id = wc_get_page_id( $woo_page_name ); $page = get_post( $page_id ); if ( ! $page ) { return array(); } $blocks = parse_blocks( $page->post_content ); if ( ! $blocks ) { return array(); } return $blocks; }