Update Cart Properties
Updates cart properties. Use truncateValue to pass prefixes that should be truncated from cart property values.
Description
The updateCartProperties() action updates cart properties. Use truncateValue to pass prefixes that should be truncated from cart property values.
Function Signature
await Superfans.actions.updateCartProperties({
truncateValue: ["MOBILE_APP_"]
});| Parameter | Type | Required | Description |
|---|---|---|---|
| truncateValue | String[] | Yes | Array of prefixes to truncate from cart property values. Each item must be a non-empty string. |
Structure of Response
| Status | Response |
|---|---|
| Success | { "status": "success", "message": "Cart properties updated" } |
| Invalid Params | { "status": "error", "errorId": 400, "errorHandle": "invalid-params", "message": "Invalid params" } |
| Unexpected Error | { "status": "error", "errorId": 500, "errorHandle": "unknown-error", "message": "Something unexpected happened" } |
Example Usage
await Superfans.actions.updateCartProperties({
truncateValue: ["MOBILE_APP_"]
});Best Practices
- Pass only the prefixes you want truncated.
- After updating properties, call
Superfans.actions.refreshCart()if the UI needs the latest cart. - Pair with
Superfans.listeners.onCartUpdatedto re-render cart attributes.
Caveats
truncateValueis required and must be an array of non-empty strings.- This action does not open the cart.
- Cart data on
Superfans.variables.cartis read-only; use this action to change properties.
Updated about 7 hours ago
Did this page help you?