Class ByProjectKeyCartsPostString

All Implemented Interfaces:
Deprecatable201Trait<ByProjectKeyCartsPostString>, ErrorableTrait<ByProjectKeyCartsPostString>, ExpandableTrait<ByProjectKeyCartsPostString>, ClientRequestCommand<Cart>, CreateHttpRequestCommand, HttpRequestCommand<Cart>, RequestCommand<Cart>

Creates a Cart in the Project.

An InvalidOperation error is returned in one of the following cases:

  1. If the referenced Shipping Method has a predicate that does not match the Cart.
  2. If the referenced Shipping Method is not active.
  3. If the referenced Shipping Method is associated with a Store that is different from the Cart's Store.
  4. If the referenced Shipping Method is associated with a Store and the Cart is not associated with any Store.

When using InventoryMode ReserveOnCart:

  • If only some Line Items can be reserved, the Cart creation succeeds, however, the items that could not be reserved are removed and reservation warnings are returned in the response.
  • If none of the Line Items can be reserved, the Cart creation fails with an InvalidOperation error.

Specific Error Codes:



   CompletableFuture<ApiHttpResponse<com.commercetools.api.models.cart.Cart>> result = apiRoot
            .withProjectKey("{projectKey}")
            .carts()
            .post("")
            .execute()