render_cart( $attributes ); } if ( 'checkout' === $attributes['shortcode'] ) { return $this->render_checkout( $attributes ); } return "You're using the ClassicShortcode block"; } /** * Get the list of classes to apply to this block. * * @param array $attributes Block attributes. Default empty array. * @return string space-separated list of classes. */ protected function get_container_classes( $attributes = array() ) { $classes = array( 'woocommerce', 'wp-block-group' ); if ( isset( $attributes['align'] ) ) { $classes[] = "align{$attributes['align']}"; } return implode( ' ', $classes ); } /** * Render method for rendering the cart shortcode. * * @param array $attributes Block attributes. * @return string Rendered block type output. */ protected function render_cart( $attributes ) { if ( ! isset( WC()->cart ) ) { return ''; } ob_start(); echo '
'; WC_Shortcode_Cart::output( array() ); echo '
'; return ob_get_clean(); } /** * Render method for rendering the checkout shortcode. * * @param array $attributes Block attributes. * @return string Rendered block type output. */ protected function render_checkout( $attributes ) { if ( ! isset( WC()->cart ) ) { return ''; } ob_start(); echo '
'; WC_Shortcode_Checkout::output( array() ); echo '
'; return ob_get_clean(); } /** * Get the frontend style handle for this block type. * * @return null */ protected function get_block_type_style() { return null; } }