Skip to content

Add Item to Cart

Adds a product to the draft cart. Each product type needs its own selection fields in addition to productId and quantity. The fields below are typed and work identically over REST and GraphQL:

Product typeFields (besides productId, quantity)
Simple / Virtual
ConfigurableselectedConfigurableOption — the chosen variant's product id
Downloadablelinks — array of downloadable-link ids
GroupedgroupedQuantities — array of { productId, quantity }
BundlebundleOptions — array of { optionId, productIds, quantity }
Bookingnot supported in admin Create-Order (returns 400)

Example bundle body:

json
{
  "productId": 142,
  "quantity": 1,
  "bundleOptions": [
    { "optionId": 5, "productIds": [10], "quantity": 1 },
    { "optionId": 6, "productIds": [12], "quantity": 1 }
  ]
}

REST also accepts the raw storefront keys

Because REST forwards the whole body to the cart, it additionally accepts the storefront snake_case shape — selected_configurable_option, bundle_options (map of optionId => [productIds]), bundle_option_qty, qty (map of productId => quantity), links. The typed fields above are recommended because they also work over GraphQL.

Endpoint

EndpointMethod
/api/admin/carts/{id}/itemsPOST

Released under the MIT License.