Skip to main content

Create a variation

POST 

/pcm/variations

Create a variation

Request

Body

required
    data objectrequired
    type stringrequired

    Possible values: [product-variation]

    This represents the type of resource object being returned. Always product-variation.

    attributes objectrequired
    name string

    The variation name.

    sort_order integer

    The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the sort_order value to program your storefront to display the variation options in the order that you want.

    The variation with the highest value of sort_order is displayed first. For example, a variation with a sort_order value of 3 appears before a variation with a sort_order value of 2.

    You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set sort_order to either null or omit it entirely from the request if you wish to remove an existing sort_order attribute.

    You must rebuild your products for the sort order changes to take effect.

Responses

Returns a created variation with the following attributes.

Schema
    data objectrequired
    id stringrequired

    A unique identifier generated when a variation is created.

    type stringrequired

    Possible values: [product-variation]

    This represents the type of resource object being returned. Always product-variation.

    attributes objectrequired
    name string

    A human-recognizable identifier for a variation.

    sort_order integer

    The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the sort_order value to program your storefront to display the variation options in the order that you want. The variation with the highest value of sort_order is displayed first. For example, a variation with a sort_order value of 3 appears before a variation with a sort_order value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set sort_order to either null or omit it entirely from the request if you wish to remove an existing sort_order attribute.

    meta objectrequired
    owner string

    Possible values: [organization, store]

    The owner of the resource, either organization or store.

    created_at date-time

    The date and time a variation is created.

    updated_at date-time

    The date and time a variation is updated.

Loading...