Cart Custom Properties

You can enable a mini cart view in the following requests to show changes to the cart immediately. Find out more in the Views for Cart modifying operations

Prerequisites

Add Custom Properties to Cart

Parameters

  • key the unique key of the property (string)

  • value the value of the property (string)

Request

curl -D- -X POST <base_url>/api/v1/carts/<cartId>/properties \
    -H 'Authorization: Bearer <ACCESS_TOKEN>'
    -H 'Content-Type: application/json' \
    -d '{
        "cultureCode": "<cultureCode>",
        "priceGroupId": "<priceGroupId>",
        "key": "<key>",
        "value": "<value>"
    }'

Response

{
    "miniCart": null,
    "success": true
}

Delete Custom Property from Cart

Parameters

Request

curl -D- -X DELETE <base_url>/api/v1/carts/<cartId>/properties/<propertyId> \
    -H 'Authorization: Bearer <ACCESS_TOKEN>'
    -H 'Content-Type: application/json' \
    -d '{
        "cultureCode": "<cultureCode>",
        "priceGroupId": "<priceGroupId>",
    }'

Response

{
    "miniCart": null,
    "success": true
}

Get Custom Properties for Cart

Request

curl -D- -X GET <base_url>/api/v1/carts/<cartId>/properties \
    -H 'Authorization: Bearer <ACCESS_TOKEN>'
    -H 'Content-Type: application/json' \

Response

{
    "customProperties":
        [
            {
                "id" : "{id}",
                "key" : "{key}",
                "value" : "{value}",
            }
        ]
}

Update Custom Properties for Cart

Parameters

Request

curl -D- -X PATCH <base_url>/api/v1/carts/<cartId>/properties/<propertyId> \
    -H 'Authorization: Bearer <ACCESS_TOKEN>'
    -H 'Content-Type: application/json' \
    -d '{
        "cultureCode": "<cultureCode>",
        "priceGroupId": "<priceGroupId>",
        "value": "<value>"
    }'

Response

{
    "miniCart": null,
    "success": true
}

Error Handling

ErrorDescription

BadRequest (400)

Execution of the pipeline fails; Price group is not found; AccessToken is not attached.

Unauthorized (401)

The token is expired.

Forbidden (403)

The token does not have access to this endpoint.

NotFound (404)

Cart or Property not found.

Conflict (409)

Property already exists on the order.

Error Response Example

{
"errors":
    [
        {
            "error-description": "Property not found.",
            "error": "NotFound"
        }
    ]
}
pageError Handling

Last updated