Update Product Option (v1)
Method & Path
PATCH /api/v1/workspace/:workspaceId/storefront/product-options/:optionId
Actual backend path: /v1/workspace/:workspaceId/storefront/product-options/:optionId
Description
Update an existing store-level product option (name, price delta, availability, sort order, or image URL).
Authentication
Required: JWT token in Authorization header.
Required Permissions: store.products.manage
Headers
| Header | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | Bearer token: Bearer <token> |
Content-Type | string | Yes | application/json |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
workspaceId | string | Yes | Workspace identifier |
optionId | string | Yes | Product option identifier |
Request Body
All fields are optional. At least one must be provided.
| Field | Type | Required | Description |
|---|---|---|---|
name | string | No | Option name |
priceDelta | number | No | Price adjustment |
imageUrl | string | null | No | URL of option image |
isAvailable | boolean | No | Whether option is available for selection in storefront |
sortOrder | number | No | Display order |
Example
{
"isAvailable": false
}
Response 200 OK
{
"option": {
"id": "507f1f77bcf86cd799439011",
"workspaceId": "507f1f77bcf86cd799439012",
"storeId": "507f1f77bcf86cd799439013",
"name": "كبير",
"priceDelta": 2.5,
"imageUrl": null,
"isAvailable": false,
"sortOrder": 0,
"createdAt": "2025-01-01T00:00:00.000Z",
"updatedAt": "2025-01-01T12:00:00.000Z"
}
}
Common Errors
- 400 Bad Request: Invalid request body or optionId
- 401 Unauthorized: Missing or invalid authentication token
- 403 Forbidden: Insufficient permissions
- 404 Not Found: Workspace, store, or product option not found
- 422 Unprocessable Entity: Validation failed
- 500 Internal Server Error: Server error