/api/client/savecart1

Save the current cart server-side. Always updates the session cart from the given positions (backup of an unsubmitted cart). If cart autosave is active for the customer (shop setting cartAutosave plus customer opt-in), the cart is additionally written into an order: a new order on the first storable save, the same order on every following save - its id is returned as oid. Order mails of such autosaved orders are deferred to the end of the session. (JS) clients can call this periodically after cart changes; a later NewOrder/ChangeOrder for the same cart is routed to that order server-side, never to a duplicate.

Change Note: replaces /api/client/modifiedcart and /api/client/resetcart (exec1.jsp), which stay for old bundles

Parameters

(int[]) HTTP POST list parameter with the index p of every cart position; the position data follows in itemid-<p>, amount-<p>, unit-<p>, unitid-<p>, ... (see below)
(int) item id of position p (negative: assortment id)
(float) amount of position p in the given unit
(string) unit of position p in text form (e.g. Stück, kg)
(int) unit id of position p (negative, if it is an alternative unit)
(float) price the client displayed for position p (logging only)
(string) optional customer note for position p
(int) optional subscription reference of position p
(int) optional assortment reference of position p
(int) optional period of a new subscription created from position p
(string) alternative to position/itemid-<p>...: order positions as HTTP POST list parameter, one occurrence per position, pipe-delimited: iid, amount, unit, unitid, aboid, isPre, note, extref (see /api/client/neworder8)
(string) delivery date of the cart in ISO format (the session date is used when missing)
(int) tour id
(int) delivery address id (0: default address)
(int) payment code the customer indicated
(string) optional note related to the whole order
(boolean) if true, the client signals that its cart equals the loaded order again (unmodified) - and it does not need to be auto saved for now. The positions are still taken over, but the session cart is marked as loaded, so it does not count as an unsaved change at session end, and the shop log records a reset instead of a change. Replaces the former /api/client/resetcart URL, which was this very call with reset=true
(string) random number per request, repeated submits of the same number are ignored
(boolean) set to true by the JS shop (single-shot mode: positions are the complete cart)
(String) optionally define the response-format for this call. One of: compact (default) | compacts | full | fulls | json | md | html | js | openapi | yaml
(int) optionally force the API to check against the role (instead of silently not returning data). For guests or public access, the default is -1. 0 (regular customer) and above define the role for which the current session is expected to be authorized.

Error Responses

HTTP StatusError CodeDescription
403not_authUser is not authenticated
403securitySecurity violation

Response Types

SaveCartResult

SaveCartResult (v1) docs

Result of saving the current cart server-side (/api/client/savecart1)

Fields (4)
#FieldTypeDescriptionLinks
0actionstringthe action that was performed
1resultstringthe exit/result code of the action
2oidintid of the order this cart has been saved into by cart autosave. 0 if the cart only lives in the session: autosave is off for this customer, the cart is not storable yet (see result, e.g. below_mbw), or this was the very first change of a new cart🔗 order_id
3autosavebooltrue if cart autosave is active for this customer (shop setting cartAutosave AND customer opt-in customers.autosave); only then can oid be set

Data (1 record)

actionresultoidautosave
ModifyCart0 →assign1 →dlvr1 →udlvr1 →order27 →order28 →order29 →state1false