WC_Cart_Session::__construct
Sets up the items provided, and calculate totals.
Method of the class: WC_Cart_Session{}
No Hooks.
Returns
null. Nothing (null).
Usage
$WC_Cart_Session = new WC_Cart_Session(); $WC_Cart_Session->__construct( $cart );
- $cart(WC_Cart) (required)
- Cart object to calculate totals for.
Changelog
| Since 3.2.0 | Introduced. |
WC_Cart_Session::__construct() WC Cart Session:: construct code WC 10.6.2
public function __construct( $cart ) {
if ( ! is_a( $cart, 'WC_Cart' ) ) {
throw new Exception( 'A valid WC_Cart object is required' );
}
$this->set_cart( $cart );
}