Update an Option

Updating Product Options

PUT /api/options/{option_id}/

To update an existing product option, send a PUT request to the endpoint with the option ID in the URL.

Request Example

PUT /api/options/27

Include the option details in the HTTP request body according to the specified Content-Type. None of the fields are required.

Request Parameters

Parameter Type Required Description
option_type string No Type of option (e.g., "S" for Select box, "R" for Radiogroup, "C" for Checkbox)
main_pair object No Image pairs for the option
variants object No Option variants (choices) available for this option

Example JSON Payload

{
  "option_type": "S",
  "main_pair": {
    "icon": {
      "image_path": {
        "2": "https://www.venddor.com.br/image3.jpg",
        "3": "https://www.venddor.com.br/image4.jpg"
      }
    }
  },
  "variants": {
    "2": {
      "variant_name": "Gift wrap"
    },
    "3": {
      "variant_name": "Present box",
      "modifier_type": "P",
      "modifier": "20"
    }
  }
}

This request changes several aspects of the option:

  • Changes the option type from Radiogroup to Select box
  • Updates the variant icons
  • Removes the "None" variant (by not including it)
  • Keeps the "Gift wrap" variant unchanged
  • Adds a new "Present box" variant that increases the product price by 20%
Important: When updating the variants object, you must specify all variants that should be included in the option. Any variants not included in the request will be deleted.

Modifier Types

Type Description
A Absolute value (fixed amount)
P Percentage (% of product price)

Response

{
  "option_id": "27"
}

Response Status Codes

Status Code Description
200 OK Option was updated successfully
400 Bad Request Invalid request parameters
404 Not Found Option with the specified ID does not exist