Skip to main content

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

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token: Bearer <token>
Content-TypestringYesapplication/json

Path Parameters

ParameterTypeRequiredDescription
workspaceIdstringYesWorkspace identifier
optionIdstringYesProduct option identifier

Request Body

All fields are optional. At least one must be provided.

FieldTypeRequiredDescription
namestringNoOption name
priceDeltanumberNoPrice adjustment
imageUrlstring | nullNoURL of option image
isAvailablebooleanNoWhether option is available for selection in storefront
sortOrdernumberNoDisplay 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