Skip to content

addProducts.v1

POST
/shopgate.cart.addProducts.v1

Adds one or multiple products to the cart. Cart rules are applied, if the shop supports them and are set up for at least one product to be added (or already placed in the cart).

Note: Depending on the installed extensions, custom errors can be returned on failure.

Media typeapplication/json
Array<object>
object
productId
string
Example
10080466570
quantity
number
Example
1
options
Array<object>
object
type
required
string
Allowed values: select text
Example
text
id
required

Id of the property, to which the selection belongs to.

string
Example
01-input-field.greeting-card-text
value
required

Content depends on the property type. It’s either the value-id of a selected property value for options or the text that was entered for inputs.

string
Example
Happy Birthday, dad!
metadata

Holds additional information about a specific product of any type. The contents of the object can vary.

object
Example
{
"additionalInfo": {
"is_parent": false
}
}

Returns an empty object after the action was performed.

Media typeapplication/json
object
output
required
object
Example
{
"output": {}
}

This error is thrown when there is an issue with adding one or multiple products to the cart. Note that the current theme only displays the first error in the array.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: ECART
message
string
errors
Array<object>
object
entityId
required
string
code
required
string
Allowed values: ENOTFOUND EINSUFFICIENTSTOCK
message
required

The message specific to the product with the matching identifier. This is either a translation string or an already translated string. Translation strings are just key/object or key/value pairs defined in the ‘locales/.json’ files, that have a translation which could be applied. The value syntax assigned for each translation string key is described here: https://github.com/yahoo/intl-messageformat#message-syntax

string
messageParams

The message params for the translation string. Translation params are just key/value pairs defined in the translation string defined in the ‘locales/.json’ for the translation key in the message property. It defaults to an empty object if the property is missing or null. The translation string syntax is described here: https://github.com/yahoo/intl-messageformat#message-syntax

object
my-custom-key
string
my-custom-value
string
translated

Indicates if the ‘message’ property contains a translated string (true) or a translation string (false or undefined). Defaults to true if the property is missing or null.

boolean
Example
{
"error": {
"code": "ECART",
"message": "There was a problem while trying to add one or multiple products.",
"errors": [
{
"entityId": "product-number-123",
"code": "EINSUFFICIENTSTOCK",
"message": "cart.error.insufficientstock",
"messageParams": {
"productName": "Apple Pie"
},
"translated": false
},
{
"entityId": "unavailable-product-with-product-number-987",
"code": "ENOTFOUND",
"message": "The product 'Samba Hat' can't be found and was therefore not added to the cart.",
"translated": true
}
]
}
}

An internal error occurred.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: EUNKNOWN
message
string
Example
{
"error": {
"code": "EUNKNOWN",
"message": "An internal error occurred."
}
}