Automattic\WooCommerce\Blocks\BlockTypes
MiniCart::handle_render_block_context
Provide a cart product reference to inner blocks rendered in the Mini Cart overlay.
The overlay is rendered out of the regular block tree (via do_blocks() the footer), so this is exposed through the render_block_context rather than a static providesContext declaration.
Метод класса: MiniCart{}
Хуков нет.
Возвращает
array. The block context, with the product reference added while the overlay renders.
Использование
$MiniCart = new MiniCart(); $MiniCart->handle_render_block_context( $context );
- $context(массив) (обязательный)
- The block context.
Код MiniCart::handle_render_block_context() MiniCart::handle render block context WC 11.3.0
public function handle_render_block_context( $context ) {
if ( ! $this->is_providing_reference_context ) {
return $context;
}
$context['woocommerce/productCollection/referenceType'] = 'cart';
return $context;
}