Skip to content

Step 14. Create a cart and add products to it [Web API Tutorial]

Ievgen Shakhsuvarov edited this page Jul 16, 2019 · 11 revisions

Create a cart

Endpoint
POST http://<host>/rest/test/V1/carts/mine

Headers
Content-Type application/json Authorization Bearer <customer token>

Payload
None

Response Magento returns the quote_id, which is an integer: 1

Complete cURL request sample

cart_id=$(curl -X POST "$endpoint/test/V1/carts/mine" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $customer_token") && echo $cart_id && cart_id=$(echo $cart_id | tr -d '"')

Add items to the cart

This article shows how to add a simple product, a configurable product, a downloadable product and a virtual product to the cart. Magento MSI has no full support for bundle product and grouped product until these issues are not resolved: #458, #459
There are also some known bugs with products of this type in Multi-Stock Mode when products are assigned to non-default stock.

Add a simple product to a cart
Add a configurable product to a cart
Add a downloadable product to a cart
Add a virtual product to a cart

◀️ Previous Step 📖 Table of Contents Next Step ▶️

MSI Documentation:

  1. Technical Vision. Catalog Inventory
  2. Installation Guide
  3. List of Inventory APIs and their legacy analogs
  4. MSI Roadmap
  5. Known Issues in Order Lifecycle
  6. MSI User Guide
  7. DevDocs Documentation
  8. User Stories
  9. User Scenarios:
  10. Technical Designs:
  11. Admin UI
  12. MFTF Extension Tests
  13. Weekly MSI Demos
  14. Tutorials
Clone this wiki locally