Option Set Options

Deprecated

Option Set Options

Options belonging to an option set.

This is archived documentation. The V2 Catalog API is deprecated. For current API documentation, see the Catalog API.

NameTypeDescription
idintThe ID of this option.
option_idintThe ID of the option to which this option set connects.
option_set_idintThe ID of this option set.
display_namestringThe friendly name used for this option set.
sort_orderintThe order in which the option is displayed on the product page.
is_requiredbooleanSpecifies whether customer is required to enter a value for this option before they can add the product to their cart.
optionresourceThe connected option.
valuesobject_arrayArray of values for the connected option.

Gets the options associated with an option set. (Default sorting is by option id, from lowest to highest.)

GET /stores/{store_hash}/v2/option_sets/{option_set_id}/options

Pagination

Parameters can be added to the URL query string to paginate the collection. The maximum limit is 250. If a limit isn’t provided, up to 50 option_set_options are returned by default.

ParameterTypeExample
Pageint/api/v2/option_sets/{option_set_id}/options?page={number}
Limitint/api/v2/option_sets/{option_set_id}/options?limit={count}

Response

Example JSON returned in the response:

[
{
"id": 43,
"option_id": 18,
"option_set_id": 14,
"display_name": "Size",
"sort_order": 0,
"is_required": true,
"option": {
"url": "https://example.com/api/v2/options/18.json",
"resource": "/options/18"
},
"values": [
{
"label": "XS",
"sort_order": 0,
"value": "XS",
"option_value_id": 68
},
{
"label": "S",
"sort_order": 1,
"value": "S",
"option_value_id": 69
},
{
"label": "M",
"sort_order": 2,
"value": "M",
"option_value_id": 70
},
{
"label": "L",
"sort_order": 3,
"value": "L",
"option_value_id": 71
},
{
"label": "XL",
"sort_order": 4,
"value": "XL",
"option_value_id": 72
}
]
},
{
"id": 44,
"option_id": 3,
"option_set_id": 14,
"display_name": "Color",
"sort_order": 1,
"is_required": true,
"option": {
"url": "https://example.com/api/v2/options/3.json",
"resource": "/options/3"
},
"values": [
{
"label": "Silver",
"sort_order": 1,
"value": "#cccccc",
"option_value_id": 7
},
{
"label": "Black",
"sort_order": 2,
"value": "#000000",
"option_value_id": 8
},
{
"label": "Purple",
"sort_order": 3,
"value": "#700170",
"option_value_id": 9
}
]
}
]

Gets an option set option.

GET /stores/{store_hash}/v2/option_sets/{option_set_id}/options/{id}

Response

Example JSON returned in the response:

{
"id": 4,
"option_id": 5,
"option_set_id": 2,
"display_name": "Clock Speeds (CPU)",
"sort_order": 0,
"is_required": true,
"option": {
"url": "https://example.com/api/v2/options/5.json",
"resource": "/options/5"
}
}

Creates a new option associated with an option set.

POST /stores/{store_hash}/v2/option_sets/{option_set_id}/options

Read-only Properties

The following properties of the option set option are read-only. If one or more of these properties are included in the request, it will be rejected.

  • id
  • option_set_id
  • values
  • option

Requirements

The following properties of the option set option are required. The request won’t be fulfilled unless these properties are valid.

  • option_id

Request

Example request object:

{
"option_id": 10,
"display_name": "Choose a color",
"sort_order": 1,
"is_required": true
}

Response

Example JSON returned in the response:

{
"id": 2,
"option_id": 10,
"option_set_id": 1,
"display_name": "Choose a color",
"sort_order": 1,
"is_required": true,
"option": {
"url": "https://example.com/api/v2/options/10.json",
"resource": "/options/10"
}
}

Updates an existing option set option.

PUT /stores/{store_hash}/v2/option_sets/{option_set_id}/options/{id}

Read-only Properties

The following properties of the option set option are read-only. If one or more of these properties are included in the request, it will be rejected.

  • id
  • option_id
  • option_set_id
  • values
  • option

Requirements

The following properties of the option set option are required. The request won’t be fulfilled unless these properties are valid.

Request

Example request object:

{
"display_name": "Pick a color...",
"sort_order": 2,
"is_required": false
}

Response

Example JSON returned in the response:

{
"id": 2,
"option_id": 10,
"option_set_id": 2,
"display_name": "Pick a color...",
"sort_order": 2,
"is_required": false,
"option": {
"url": "https://example.com/api/v2/options/10.json",
"resource": "/options/10"
}
}

Deletes an option belonging to an option set.

DELETE /stores/{store_hash}/v2/option_sets/{option_set_id}/options/{id}

Deletes multiple options associated with an option set.

DELETE /stores/{store_hash}/v2/option_sets/{option_set_id}/options

Pagination

Parameters can be added to the URL query string to paginate the collection. The maximum limit is 250. If a limit isn’t provided, up to 50 option_set_options are returned by default.

ParameterTypeExample
Pageint/api/v2/option_sets/{option_set_id}/options?page={number}
Limitint/api/v2/option_sets/{option_set_id}/options?limit={count}