Automattic\WooCommerce\Blocks\BlockTypes
ClassicShortcode::render_cart
Render method for rendering the cart shortcode.
Method of the class: ClassicShortcode{}
No Hooks.
Returns
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() ClassicShortcode::render cart code WC 10.3.3
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();
}