Operators who are not using the Marketplacer front-end can create optional option types.
You can set an option type to optional or required via the Operator Portal UI, the bulk upload CSV, or the graphQL API.
Notes:
- Changing an optional option type to a required option type results in the products using that option type being unpublished,
- Changing a required option type to an optional option type does not.
Sellers are not required to fill out optional option types to list their products. Sellers can determine which option types are optional via the Seller Portal 2.0 UI.
Configure optional option types through the Operator Portal
- Log in to the Operator Portal.
- Go to Categorisation > Variants or Categorisation > Features.
- Do one of the following:
- To create a new option type, select New Option Type.
- To edit an existing option type, click the option type you want to edit within the table.
- Find and select the Optional toggle to make the option type optional.
- Select Update.
Configure optional option types through the Bulk CSV Uploader
You can change the optionality of option types when using the Option Type CSV upload tool by setting either TRUE or FALSE in the Optional column.
Configure optional option types through the graphQL API
Option Types can only be created or updated by using the admin API key.
Create new option types
Here is an example mutation for creating a new option type. The prototypeId must already exist.
mutation{
optionTypeCreateOrUpdate(
input: {
displayName: "New OptionType",
name: "New OptionType",
category: VARIANT*
prototypeIds:"someID"
optional: true*
}){
errors{
field
messages}
optionType{
optional
id
name
}}}
* Select an appropriate value from the dropdown
Update existing option types
Here is an example mutation for updating the attributes of an existing option type to optional, where id is the ID of the option type that you intend on updating. The prototypeID is optional field for updating option type.
mutation{
optionTypeCreateOrUpdate(
input: {
id: "OptionTypeID"
displayName: "New OptionType",
name: "New OptionType",
category: VARIANT*
prototypeIds:"someID"
optional: true*
}){
errors{
field
messages}
optionType{
optional
id
name
}}}
* Select an appropriate value from the dropdown
Retrieve all the option types and fields created
Here is an example of a query to retrieve all the option types and their associated fields that have been created.
query{
prototypes{
nodes{
id
optionTypes{
nodes{
id
optional
optionValues{
nodes{
id
name
}}}}}}}
Retrieve an option type and fields created
Here is an example of a query to retrieve an option type and its associated fields that have been created. The option types reside within the prototype query and can be retrieved by providing the prototypeID.
query{
prototypes
( ids:"someprototypeID")
{
nodes{
id
optionTypes{
nodes{
id
optional
}}}}}
Seller Experience
Seller portal 2.0
When an option type is set to optional, sellers will not be required to select a value for that option type to publish their products or variants. Sellers can determine which option types are optional in the Seller portal 2.0, required fields are marked with asterisks.
Retrieve option type as a seller using API V2
For sellers using the V2 API, they can retrieve the option type values using the following endpoints:
- During advert creation:
- GET /api/v2/client/adverts/advert_id/variants/new
- To view all variant option types in use by the seller:
- GET /api/v2/client/variants
- To view all variant option types in use in a particular advert:
- GET /api/v2/client/adverts/advert_id/variants/variant_id
- Option Types can be identified as optional by the “optional” boolean field:
-
"attributes": {
"optional": true}
Note: Only seller-specific adverts and related variants can be viewed using the seller API key and cannot be edited or updated.
Related articles