if ($product instanceof LineItem
) { $this->items->
add($product);
/** @var ItemFacade $product */
$product =
$this->
get($product->
getId());
return $product;
} $product =
$this->helper->
product($product,
$quantity,
$this->context
);
$this->items->
add($product);
/** @var ItemFacade $product */
$product =
$this->
get($product->
getId());
return $product;
} /**
* `create()` creates a new product line-item for the product with the given id in the given quantity.
* Note that the created line-item will not be added automatically to this collection, use `add()` for that.
*
* @param string $productId The product id for which a line-item should be created.
* @param int $quantity Optionally provide the quantity with which the product line-item should be created, defaults to 1.
*
* @return ItemFacade The newly created product line-item.
*/