# Update Custom Option

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v1/products/{product_id}/custom_options_fields/{custom_option_field_id}/:
    put:
      summary: Update Custom Option
      deprecated: false
      description: >-
        Updates an existing custom option field. This endpoint will replace the
        old data with the new data passed in the payload of this endpoint
        request.


        <Accordion title="🔑Scopes" defaultOpen>
            
          `products.read_write` - Products Read & Write
         
        </Accordion>
      operationId: update-custom-options
      tags:
        - Default module/Apps/Merchant APIs/Products/Product Variants
        - Product Customizations
      parameters:
        - name: product_id
          in: path
          description: The unique identifier for the product.
          required: true
          example: e0ad7a76-ba42-4c59-94c9-0da600117fbf
          schema:
            type: string
            examples:
              - 107c2ff5-5c70-4749-b9bd-56dc1793013b
        - name: custom_option_field_id
          in: path
          description: ''
          required: true
          example: a8b0e6ce-6937-4c56-8253-9478d0f28475
          schema:
            type: string
        - name: Access-Token
          in: header
          description: >-
            This token is used to authenticate and access information related to
            the store. It is obtained through an OAuth mechanism and is required
            to perform operations on the store's data. The `Access-Token` should
            be included in the header of API requests that require store-related
            information.
          required: true
          example: '{{Access-Token}}'
          schema:
            type: string
        - name: Store-Id
          in: header
          description: Unique identifier of the store.
          required: true
          example: '{{StoreId}}'
          schema:
            type: number
            examples:
              - 37213
        - name: Role
          in: header
          description: ''
          required: true
          example: Manager
          schema:
            type: string
        - name: Accept-Language
          in: header
          description: >-
            Preferred language for the response. Defaults to `en` if not
            specified.
          required: false
          example: en
          schema:
            type: string
            enum:
              - en
              - ar
            examples:
              - en
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomOptionRequestObject'
            example:
              id: a8b0e6ce-6937-4c56-8253-9478d0f28475
              type: CHECKBOX
              hint:
                ar: يرجى اختيار الخيار المناسب
                en: Please select a suitable option
              label:
                ar: خيار مخصص
                en: custom option
              min_choices: 1
              max_choices: 50
              is_required: false
              can_choose_multiple_options: true
              choices:
                - price: 66.5
                  id: 0908e710-f3fe-4c56-80c0-bd317c8e6f5d
                  ar: قيمة 1
                  en: value 1
              display_order: 4
              visibility_condition: null
              is_published: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomOptionObject'
          headers: {}
          x-apidog-name: Success
        '401':
          description: ''
          content:
            application/json:
              schema:
                type: object
                description: >-
                  Response returned when the request cannot be authenticated
                  because the required credentials are missing, invalid, or
                  expired.
                properties:
                  status:
                    type: string
                    description: Indicates the overall status of the API response.
                    examples:
                      - error
                  message:
                    type: object
                    description: >-
                      Contains structured details explaining why the request
                      could not be authenticated.
                    properties:
                      type:
                        type: string
                        description: Indicates the category of the response message.
                        examples:
                          - error
                      code:
                        type: string
                        description: >-
                          A machine-readable code identifying the authentication
                          error. Returns null when no specific code is
                          available.
                        examples:
                          - UNAUTHORIZED
                        nullable: true
                      name:
                        type: string
                        description: >-
                          A short, human-readable title describing the
                          authentication error. Returns null when no title is
                          available.
                        examples:
                          - Unauthorized
                        nullable: true
                      description:
                        type: string
                        description: >-
                          A human-readable explanation of why the request could
                          not be authenticated. Returns null when no detailed
                          explanation is available.
                        examples:
                          - >-
                            Authentication credentials are missing, invalid, or
                            expired.
                        nullable: true
                    required:
                      - type
                      - code
                      - name
                      - description
                    x-apidog-orders:
                      - type
                      - code
                      - name
                      - description
                    x-apidog-ignore-properties: []
                required:
                  - status
                  - message
                x-apidog-orders:
                  - status
                  - message
                examples:
                  - status: error
                    message:
                      type: error
                      code: UNAUTHORIZED
                      name: Unauthorized
                      description: >-
                        Authentication credentials are missing, invalid, or
                        expired.
                x-apidog-ignore-properties: []
              examples:
                '1':
                  summary: Example 1
                  value:
                    status: error
                    message:
                      type: error
                      code: ERROR_SESSION_MISSING
                      name: Sorry
                      description: Please login first.
                '2':
                  summary: Example 2
                  value:
                    status: error
                    message:
                      type: error
                      code: ERROR_SESSION_INVALID
                      name: Sorry
                      description: Login session expired. Please login again.
                '3':
                  summary: Example 3
                  value:
                    status: error
                    message:
                      type: error
                      code: ERROR_SESSION_INVALID
                      name: Sorry
                      description: Invalid authentication
          headers: {}
          x-apidog-name: Unauthorized
        '500':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: Status of the error.
                  message:
                    $ref: '#/components/schemas/ResponseEnvelopMessage'
                required:
                  - status
                  - message
                x-apidog-orders:
                  - status
                  - message
                x-apidog-ignore-properties: []
              example:
                status: error
                message:
                  type: error
                  code: MSG_HIDDEN
                  name: Error
                  description: Internal Server Error
          headers: {}
          x-apidog-name: Internal Server error
      security: []
      x-apidog-folder: Default module/Apps/Merchant APIs/Products/Product Variants
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/613905/apis/api-28843617-run
components:
  schemas:
    CustomOptionRequestObject:
      type: object
      properties:
        label:
          type: object
          properties:
            ar:
              type: string
              description: 'The label in Arabic. '
            en:
              type: string
              description: The label in English.
          required:
            - ar
            - en
          x-apidog-orders:
            - ar
            - en
          description: >-
            This represents the display name of the custom option.

            It is a localized object where each key is a language code and the
            value is the corresponding translated label.
          x-apidog-ignore-properties: []
        hint:
          type: object
          properties:
            ar:
              type: string
              description: The hint text in Arabic.
            en:
              type: string
              description: The hint text in English.
          x-apidog-orders:
            - ar
            - en
          description: >-
            This provides additional information or guidance about the custom
            option, often used as a tooltip or additional label for users.
          required:
            - ar
            - en
          x-apidog-ignore-properties: []
        type:
          anyOf:
            - type: string
              description: CHECKBOX
            - type: string
              description: DROPDOWN
          description: >-
            This field is optional and the type will be determined based on the
            value of `can_choose_multiple_options`
        min_choices:
          type: integer
          description: The minimum number of choices that must be selected.
          default: 1
        max_choices:
          type: integer
          description: The maximum number of choices that can be selected.
          default: 100
        can_choose_multiple_options:
          type: boolean
          description: >-
            If `true`, option type will be CHECKBOX. If `false`, option type
            will be Dropdown.
          default: true
        is_published:
          type: boolean
          description: >-
            Specifies whether this custom option is required for selection by
            the customer.
          default: true
        is_required:
          type: boolean
          description: >-
            Specifies whether this custom option is required for selection by
            the customer.
          default: false
        display_order:
          type: integer
          description: >-
            The display order of this custom option in relation to other custom
            options.
        choices:
          type: array
          items:
            type: object
            properties:
              ar:
                type: string
                description: The choice or option name in Arabic.
              en:
                type: string
                description: The choice or option name in English.
              price:
                type: integer
                description: The price associated with this option.
                default: 0
            x-apidog-orders:
              - ar
              - en
              - price
            x-apidog-ignore-properties: []
          description: >-
            A list of available choices (options) for the custom option feature.
            Each choice can have multiple translations and an associated price.
      required:
        - label
        - choices
      x-apidog-orders:
        - label
        - hint
        - type
        - min_choices
        - max_choices
        - can_choose_multiple_options
        - is_published
        - is_required
        - display_order
        - choices
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    CustomOptionObject:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
        label:
          type: object
          properties:
            ar:
              type: string
            en:
              type: string
          required:
            - ar
            - en
          x-apidog-orders:
            - ar
            - en
          x-apidog-ignore-properties: []
        hint:
          type: object
          properties:
            ar:
              type: string
            en:
              type: string
          required:
            - ar
            - en
          x-apidog-orders:
            - ar
            - en
          x-apidog-ignore-properties: []
        min_choices:
          type: integer
        max_choices:
          type: integer
        can_choose_multiple_options:
          type: boolean
        is_published:
          type: boolean
        is_required:
          type: boolean
        display_order:
          type: integer
        choices:
          type: array
          items:
            type: object
            properties:
              ar:
                type: string
              en:
                type: string
              price:
                type: number
              id:
                type: string
            x-apidog-orders:
              - ar
              - en
              - price
              - id
            x-apidog-ignore-properties: []
        visibility_condition:
          type: object
          properties: {}
          x-apidog-orders: []
          x-apidog-ignore-properties: []
          nullable: true
      required:
        - id
        - type
        - label
        - hint
        - min_choices
        - max_choices
        - can_choose_multiple_options
        - is_published
        - is_required
        - display_order
        - choices
        - visibility_condition
      x-apidog-orders:
        - id
        - type
        - label
        - hint
        - min_choices
        - max_choices
        - can_choose_multiple_options
        - is_published
        - is_required
        - display_order
        - choices
        - visibility_condition
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    ResponseEnvelopMessage:
      type: object
      properties:
        type:
          type: string
          description: Type of response message returned by the API.
          examples:
            - success
        code:
          type: string
          description: Response code returned by the API, if available.
          examples:
            - MSG_POPUP_OK
          nullable: true
        name:
          type: string
          description: Name or title of the response message, if available.
          examples:
            - Coupons
          nullable: true
        description:
          type: string
          description: Detailed description of the response message, if available.
          examples:
            - Coupons created successfully
          nullable: true
      required:
        - type
        - code
        - name
        - description
      description: Additional response metadata.
      x-apidog-orders:
        - type
        - code
        - name
        - description
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
  securitySchemes: {}
servers:
  - url: https://api.zid.sa/
    description: Prod Env
security: []

```
