Magento – Magento 2: How to create new customer cart via rest API

apimagento2rest

I want to place an order for a customer from API. Currently, I do:

  1. Login as integration (OAuth).
  2. Create customer
  3. Create customer cart (or take an existing one).
  4. Remove all items from the cart.
  5. Add items to the cart.
  6. Place order.

A customer may have only 1 active cart. I must use the customer cart from Magento and remove the customer's products from his cart. This is not good.

How can I use the cart without touching an existing customer cart?

Best Answer

I assume you add items by posting to

[POST] /rest/V1/carts/mine/items

But you can also post to a specific cart id

[POST] /rest/V1/carts/{{cart-id}}/items

Hope it helps..

Related Topic