Automattic\WooCommerce\Blocks\BlockTypes
MiniCart::render
Render the Mini-Cart block.
Method of the class: MiniCart{}
No Hooks.
Returns
String. Rendered block type output.
Usage
// protected - for code of main (parent) or child class $result = $this->render( $attributes, $content, $block );
- $attributes(array) (required)
- Block attributes.
- $content(string) (required)
- Block content.
- $block(WP_Block) (required)
- Block instance.
MiniCart::render() MiniCart::render code WC 10.7.0
protected function render( $attributes, $content, $block ) {
/**
* Do not render for logged-out users if the Coming Soon mode is enabled for store pages only.
*/
$coming_soon_helper = wc_get_container()->get( ComingSoonHelper::class );
if ( ! is_user_logged_in() && ! WC()->is_rest_api_request() && $coming_soon_helper->is_store_coming_soon() ) {
return '';
}
/**
* In the cart and checkout pages, the block is either rendered hidden or removed.
* It is not interactive, so it can fall back to the existing implementation.
*/
if ( Features::is_enabled( 'experimental-iapi-mini-cart' ) && ! is_cart() && ! is_checkout() ) {
return $this->render_experimental_iapi_mini_cart( $attributes, $content, $block );
}
return $content . $this->get_markup( MiniCartUtils::migrate_attributes_to_color_panel( $attributes ) );
}