WordPress at Your Fingertips
function is not described


AbstractCartRoute::__construct() public WC 1.0

Constructor accepts two types of schema; one for the item being returned, and one for the cart as a whole. These may be the same depending on the route.

{} It's a method of the class: AbstractCartRoute{}

No Hooks.


null. Nothing.


$AbstractCartRoute = new AbstractCartRoute();
$AbstractCartRoute->__construct( $cart_schema, $item_schema, $cart_controller );
$cart_schema(CartSchema) (required)
Schema class for the cart.
Schema class for this route's items if it differs from the cart schema.
Default: null
$cart_controller(CartController) (required)
Cart controller class.

Code of AbstractCartRoute::__construct() WC 5.8.0

public function __construct( CartSchema $cart_schema, AbstractSchema $item_schema = null, CartController $cart_controller ) {
	$this->schema          = is_null( $item_schema ) ? $cart_schema : $item_schema;
	$this->cart_schema     = $cart_schema;
	$this->cart_controller = $cart_controller;