getCartItems(); $cart = new Cart(); $cart->setAddressDeliveryId($this->getAddressDeliveryId()); $cart->setAddressInvoiceId($this->getAddressInvoiceId()); $cart->setToken($token); if ($customer){ $cart->setCustomer($customer); } // TODO : set current Currency //$cart->setCurrency() $cart->save(); foreach ($cartItems as $cartItem){ $item = new CartItem(); $item->setCart($cart); $item->setProductId($cartItem->getProductId()); $item->setQuantity($cartItem->getQuantity()); $item->save(); } return $cart; } }