Hygraph
Docs

#Lesson 3.1 - Configure enumerations

In this lesson, you will create enumerations for product size and color values that the product variant components will use. These must exist in the schema before you can build the product variant components in lesson 4.

#Add enumerations

All enumerations follow the same process. In the Schema editor, click +Add next to Enumerations in the left sidebar. Fill in the display name and API ID, then add enumeration values one by one by entering the display name and clicking + Add. Click Add Enumeration to save.

  1. Go to Schema, and click +Add next to Enumerations.

  2. Provide the following values for each enumeration, and click Add Enumeration to save.

    Clothes size

    FieldInput
    Display nameClothes size
    API IDClothesSize
    Enumeration valuesOne by one, add the following: XS, S, M, L, XL

    Shoes size

    FieldInput
    Display nameShoes size
    API IDShoesSize
    Enumeration valuesSize_35, Size_36, Size_37, Size_38, Size_39, Size_40, Size_41, Size_42, Size_43, Size_44

    Wearable items color

    FieldInput
    Display nameWearable items color
    API IDWearableItemsColor
    Enumeration valuesRed, Green, Blue, Black, White

    Decor items color

    FieldInput
    Display nameDecor items color
    API IDDecorColor
    Enumeration valuesGold, Silver, Bronze, Cobalt

After adding all enumerations, the left sidebar should look like this:

Your enumerations listed in the schemaYour enumerations listed in the schema

Why separate enumerations for shoes and clothes sizes? Shoes and clothing use different size scales. A single "size" enumeration would mix EU shoe sizes with clothing sizes, producing a dropdown that is inconvenient to use in the content editor. Separate enumerations keep each product type's fields meaningful and required.

#What's next

Lesson 4.1 - Build components

Or, go to the Tutorial overview for the full lesson list.