Cart::render( $attr,  $instance )

Summary

No summary available.

Source

File: src/BigCommerce/Shortcodes/Cart.php

	public function render( $attr, $instance ) {
		if ( ( (bool) get_option( Settings\Sections\Cart::OPTION_ENABLE_CART, true ) ) == false ) {
			return ''; // render nothing if the cart is disabled
		}

		$attr = shortcode_atts( [
		], $attr, self::NAME );

		$cart = $this->get_cart( $attr );

		if ( count( $cart[ 'items' ] ) > 0 ) {
			$controller = Templates\Cart::factory( [
				Templates\Cart::CART => $cart,
			] );
		} else {
			$controller = Templates\Cart_Empty::factory( [
				Templates\Cart::CART => $cart,
			] );
		}

		return $controller->render();
	}

User Contributed Notes

You must log in before being able to contribute a note or feedback.