Automattic\WooCommerce\Blocks\BlockTypes

ClassicShortcode::render_cart()protectedWC 1.0

Render method for rendering the cart shortcode.

Method of the class: ClassicShortcode{}

No Hooks.

Return

String. Rendered block type output.

Usage

// protected - for code of main (parent) or child class
$result = $this->render_cart( $attributes );
$attributes(array) (required)
Block attributes.

ClassicShortcode::render_cart() code WC 9.4.2

protected function render_cart( $attributes ) {
	if ( ! isset( WC()->cart ) ) {
		return '';
	}

	ob_start();

	echo '<div class="' . esc_attr( $this->get_container_classes( $attributes ) ) . '">';
	WC_Shortcode_Cart::output( array() );
	echo '</div>';

	return ob_get_clean();
}