public function CartProviderInterface::createCart in Commerce Core 8.2
Creates a cart order for the given store and user.
Parameters
string $order_type: The order type ID.
\Drupal\commerce_store\Entity\StoreInterface $store: The store. If empty, the current store is assumed.
\Drupal\Core\Session\AccountInterface $account: The user. If empty, the current user is assumed.
Return value
\Drupal\commerce_order\Entity\OrderInterface The created cart order.
Throws
\Drupal\commerce_cart\Exception\DuplicateCartException When a cart with the given criteria already exists.
1 method overrides CartProviderInterface::createCart()
- CartProvider::createCart in modules/
cart/ src/ CartProvider.php - Creates a cart order for the given store and user.
File
- modules/
cart/ src/ CartProviderInterface.php, line 32
Class
- CartProviderInterface
- Creates and loads carts for anonymous and authenticated users.
Namespace
Drupal\commerce_cartCode
public function createCart($order_type, StoreInterface $store = NULL, AccountInterface $account = NULL);