Catalog variants
The sellable combinations of one product’s options — a colour and a size — each with an SKU of its own and prices and pictures of its own or else the product’s. Every product has at least one, and :batch_create, :batch_update and :batch_delete write many at once, all or none.
List catalog variants
Lists the product's variants, in the order they were made: create_time, oldest first by default. filter takes sku, is_active, create_time and option_pairs:"color=red" — the variants with that value of an option; each comes with what it sells at and is shown with.
path Parameters
website_idId of the parent website.
product_idThe id of the product this is a variant of — the {product} of name. Fixed by the URL.
query Parameters
page_sizeRows per page. Over the maximum is clamped, not rejected.
page_tokenOpaque token from a previous next_page_token. A token minted under a different order_by/filter is rejected.
skipRows to skip before the page (AIP-158). skip + page_size is capped at 10000; beyond that is OUT_OF_RANGE.
order_byComma-separated field [asc|desc], at most 3 keys. Default: create_time asc. Sortable: create_time.
filterAIP-160 subset (§8). Filterable: create_time, is_active, option_pairs, sku. A field outside the list is INVALID_ARGUMENT.
List catalog variants › Responses
One page of variants.
This page of variants, in the requested order.
next_page_tokenOpaque. Absent or empty means this was the last page.
total_sizeRows in the whole filtered collection, not in this page.
Create catalog variant
Adds a variant to the product. option_values holds one value of each of the product's variant_options — one of its attribute's options — and sku is required: values another variant of the product has, or an sku another variant of the website has, answer ALREADY_EXISTS. prices are held to the website's currencies as the product's — an entry overrides the product's in its currency — and the pictures are files of the website's media library. A product with 10000 variants answers FAILED_PRECONDITION. The product's variant_count, price_min and price_max move with it.
path Parameters
website_idId of the parent website.
product_idThe id of the product this is a variant of — the {product} of name. Fixed by the URL.
Create catalog variant › Request Body
skuThe variant's stock-keeping unit: 1 to 64 letters, digits, dots, underscores and dashes, case kept — AB-1 and ab-1 are two. Unique among the website's variants: every SKU is a variant's. While the variant is its product's only one, the product shows it as its sku.
option_valuesThe variant's value of each of its product's variant_options: an object from each one's key to the value of one of that attribute's options — one per option, no other key. {} on a product without options, whose one variant is its default. Values another variant of the product has answer ALREADY_EXISTS. Required on create and fixed afterwards; omitted when empty.
pricesThe variant's own prices, entries as the product's prices, held to the same rules — the base currency's entry among them when there are any. An entry overrides the product's in its currency whole: without a sale_amount the variant has no special price there. A currency it has no entry in is the product's; empty — the default — sells at the product's prices, and null under update_mask goes back to them.
image_media_idsThe ids of the media items that picture the variant, in their order — the first is the main one. Each once, at most 20, every one of the website's media library. Empty — the default — shows the product's pictures, and their alt text is the product's. Replaced whole when sent; null under update_mask empties it. Deleting a media item takes it off every variant it pictures.
is_activeWhether the variant is on sale. true when omitted. One switched off stays the product's, counted in its variant_count but in no price range.
weightThe variant's weight in the website's unit of weight, general.catalog.weight_unit: a decimal string from 0 to 1000000 with at most three digits after the point, returned in its shortest form ("1.25"). A JSON number is taken on a write too. Absent — not known; null under update_mask clears it.
lengthThe variant's length in the website's unit of length, general.catalog.dimension_unit: a decimal string as weight's, from 0 to 1000000, at most three digits after the point. Absent — not known; null under update_mask clears it.
widthThe variant's width in the website's unit of length, general.catalog.dimension_unit, written as length. Absent — not known; null under update_mask clears it.
heightThe variant's height in the website's unit of length, general.catalog.dimension_unit, written as length. Absent — not known; null under update_mask clears it.
Create catalog variant › Responses
The created resource.
nameThe resource name (§5) — the identity of this resource, and the path that addresses it: websites/{website}/cms_pages/{cms_page}. It is the handle to store, not a human label.
idThe last segment of name on its own, for a client that needs to build a child URL. Unique inside its parent, never across the platform.
create_timeWhen the resource was created (RFC 3339, UTC).
update_timeWhen the resource last changed (RFC 3339, UTC).
etagVersion of the persisted state. Send it back in If-Match on Update or Delete and the write is rejected with ABORTED if anyone else changed the resource meanwhile (§14).
product_idThe id of the product this is a variant of — the {product} of name. Fixed by the URL.
option_valuesThe variant's value of each of its product's variant_options: an object from each one's key to the value of one of that attribute's options — one per option, no other key. {} on a product without options, whose one variant is its default. Values another variant of the product has answer ALREADY_EXISTS. Required on create and fixed afterwards; omitted when empty.
option_pairsThe option values as key=value strings, kept by the server: option_pairs:"color=red" lists the product's variants with that value.
skuThe variant's stock-keeping unit: 1 to 64 letters, digits, dots, underscores and dashes, case kept — AB-1 and ab-1 are two. Unique among the website's variants: every SKU is a variant's. While the variant is its product's only one, the product shows it as its sku.
pricesThe variant's own prices, entries as the product's prices, held to the same rules — the base currency's entry among them when there are any. An entry overrides the product's in its currency whole: without a sale_amount the variant has no special price there. A currency it has no entry in is the product's; empty — the default — sells at the product's prices, and null under update_mask goes back to them.
image_media_idsThe ids of the media items that picture the variant, in their order — the first is the main one. Each once, at most 20, every one of the website's media library. Empty — the default — shows the product's pictures, and their alt text is the product's. Replaced whole when sent; null under update_mask empties it. Deleting a media item takes it off every variant it pictures.
is_activeWhether the variant is on sale. true when omitted. One switched off stays the product's, counted in its variant_count but in no price range.
weightThe variant's weight in the website's unit of weight, general.catalog.weight_unit: a decimal string from 0 to 1000000 with at most three digits after the point, returned in its shortest form ("1.25"). A JSON number is taken on a write too. Absent — not known; null under update_mask clears it.
lengthThe variant's length in the website's unit of length, general.catalog.dimension_unit: a decimal string as weight's, from 0 to 1000000, at most three digits after the point. Absent — not known; null under update_mask clears it.
widthThe variant's width in the website's unit of length, general.catalog.dimension_unit, written as length. Absent — not known; null under update_mask clears it.
heightThe variant's height in the website's unit of length, general.catalog.dimension_unit, written as length. Absent — not known; null under update_mask clears it.
effective_pricesWhat the variant sells at, currency by currency: its own entry, or else the product's. Empty when neither has one. Kept by the server.
effective_image_media_idsThe pictures the variant is shown with: its own image_media_ids, or else the product's. Kept by the server.
Get catalog variant
Reads one variant of the product, with effective_prices and effective_image_media_ids — its own prices currency by currency and its pictures, or else the product's.
path Parameters
website_idId of the parent website.
product_idThe id of the product this is a variant of — the {product} of name. Fixed by the URL.
variant_idId of the parent variant.
Headers
If-None-MatchA matching etag answers 304 with no body (§16).
Get catalog variant › Responses
The resource.
nameThe resource name (§5) — the identity of this resource, and the path that addresses it: websites/{website}/cms_pages/{cms_page}. It is the handle to store, not a human label.
idThe last segment of name on its own, for a client that needs to build a child URL. Unique inside its parent, never across the platform.
create_timeWhen the resource was created (RFC 3339, UTC).
update_timeWhen the resource last changed (RFC 3339, UTC).
etagVersion of the persisted state. Send it back in If-Match on Update or Delete and the write is rejected with ABORTED if anyone else changed the resource meanwhile (§14).
product_idThe id of the product this is a variant of — the {product} of name. Fixed by the URL.
option_valuesThe variant's value of each of its product's variant_options: an object from each one's key to the value of one of that attribute's options — one per option, no other key. {} on a product without options, whose one variant is its default. Values another variant of the product has answer ALREADY_EXISTS. Required on create and fixed afterwards; omitted when empty.
option_pairsThe option values as key=value strings, kept by the server: option_pairs:"color=red" lists the product's variants with that value.
skuThe variant's stock-keeping unit: 1 to 64 letters, digits, dots, underscores and dashes, case kept — AB-1 and ab-1 are two. Unique among the website's variants: every SKU is a variant's. While the variant is its product's only one, the product shows it as its sku.
pricesThe variant's own prices, entries as the product's prices, held to the same rules — the base currency's entry among them when there are any. An entry overrides the product's in its currency whole: without a sale_amount the variant has no special price there. A currency it has no entry in is the product's; empty — the default — sells at the product's prices, and null under update_mask goes back to them.
image_media_idsThe ids of the media items that picture the variant, in their order — the first is the main one. Each once, at most 20, every one of the website's media library. Empty — the default — shows the product's pictures, and their alt text is the product's. Replaced whole when sent; null under update_mask empties it. Deleting a media item takes it off every variant it pictures.
is_activeWhether the variant is on sale. true when omitted. One switched off stays the product's, counted in its variant_count but in no price range.
weightThe variant's weight in the website's unit of weight, general.catalog.weight_unit: a decimal string from 0 to 1000000 with at most three digits after the point, returned in its shortest form ("1.25"). A JSON number is taken on a write too. Absent — not known; null under update_mask clears it.
lengthThe variant's length in the website's unit of length, general.catalog.dimension_unit: a decimal string as weight's, from 0 to 1000000, at most three digits after the point. Absent — not known; null under update_mask clears it.
widthThe variant's width in the website's unit of length, general.catalog.dimension_unit, written as length. Absent — not known; null under update_mask clears it.
heightThe variant's height in the website's unit of length, general.catalog.dimension_unit, written as length. Absent — not known; null under update_mask clears it.
effective_pricesWhat the variant sells at, currency by currency: its own entry, or else the product's. Empty when neither has one. Kept by the server.
effective_image_media_idsThe pictures the variant is shown with: its own image_media_ids, or else the product's. Kept by the server.
Delete catalog variant
Deletes a variant, with its entries in every price list. The product's last one answers FAILED_PRECONDITION: a product keeps at least one variant — delete the product to take it. Its pictures stay in the media library.
path Parameters
website_idId of the parent website.
product_idThe id of the product this is a variant of — the {product} of name. Fixed by the URL.
variant_idId of the parent variant.
Headers
If-MatchThe etag the client last read. A mismatch is ABORTED (409) with the current resource in the error details (§14).
Delete catalog variant › Responses
Deleted. No body (§7).
Update catalog variant
Changes a variant. option_values are fixed and refused here. A new sku is checked as on create; prices and image_media_ids set to null under update_mask go back to the product's. The SKU of a product's only variant is the one the product shows.
path Parameters
website_idId of the parent website.
product_idThe id of the product this is a variant of — the {product} of name. Fixed by the URL.
variant_idId of the parent variant.
query Parameters
update_maskComma-separated field paths to merge. A field named here and sent as null is cleared; without the mask a null is dropped (§7, §11).
Headers
If-MatchThe etag the client last read. A mismatch is ABORTED (409) with the current resource in the error details (§14).
Update catalog variant › Request Body
skuThe variant's stock-keeping unit: 1 to 64 letters, digits, dots, underscores and dashes, case kept — AB-1 and ab-1 are two. Unique among the website's variants: every SKU is a variant's. While the variant is its product's only one, the product shows it as its sku.
pricesThe variant's own prices, entries as the product's prices, held to the same rules — the base currency's entry among them when there are any. An entry overrides the product's in its currency whole: without a sale_amount the variant has no special price there. A currency it has no entry in is the product's; empty — the default — sells at the product's prices, and null under update_mask goes back to them.
image_media_idsThe ids of the media items that picture the variant, in their order — the first is the main one. Each once, at most 20, every one of the website's media library. Empty — the default — shows the product's pictures, and their alt text is the product's. Replaced whole when sent; null under update_mask empties it. Deleting a media item takes it off every variant it pictures.
is_activeWhether the variant is on sale. true when omitted. One switched off stays the product's, counted in its variant_count but in no price range.
weightThe variant's weight in the website's unit of weight, general.catalog.weight_unit: a decimal string from 0 to 1000000 with at most three digits after the point, returned in its shortest form ("1.25"). A JSON number is taken on a write too. Absent — not known; null under update_mask clears it.
lengthThe variant's length in the website's unit of length, general.catalog.dimension_unit: a decimal string as weight's, from 0 to 1000000, at most three digits after the point. Absent — not known; null under update_mask clears it.
widthThe variant's width in the website's unit of length, general.catalog.dimension_unit, written as length. Absent — not known; null under update_mask clears it.
heightThe variant's height in the website's unit of length, general.catalog.dimension_unit, written as length. Absent — not known; null under update_mask clears it.
Update catalog variant › Responses
The updated resource.
nameThe resource name (§5) — the identity of this resource, and the path that addresses it: websites/{website}/cms_pages/{cms_page}. It is the handle to store, not a human label.
idThe last segment of name on its own, for a client that needs to build a child URL. Unique inside its parent, never across the platform.
create_timeWhen the resource was created (RFC 3339, UTC).
update_timeWhen the resource last changed (RFC 3339, UTC).
etagVersion of the persisted state. Send it back in If-Match on Update or Delete and the write is rejected with ABORTED if anyone else changed the resource meanwhile (§14).
product_idThe id of the product this is a variant of — the {product} of name. Fixed by the URL.
option_valuesThe variant's value of each of its product's variant_options: an object from each one's key to the value of one of that attribute's options — one per option, no other key. {} on a product without options, whose one variant is its default. Values another variant of the product has answer ALREADY_EXISTS. Required on create and fixed afterwards; omitted when empty.
option_pairsThe option values as key=value strings, kept by the server: option_pairs:"color=red" lists the product's variants with that value.
skuThe variant's stock-keeping unit: 1 to 64 letters, digits, dots, underscores and dashes, case kept — AB-1 and ab-1 are two. Unique among the website's variants: every SKU is a variant's. While the variant is its product's only one, the product shows it as its sku.
pricesThe variant's own prices, entries as the product's prices, held to the same rules — the base currency's entry among them when there are any. An entry overrides the product's in its currency whole: without a sale_amount the variant has no special price there. A currency it has no entry in is the product's; empty — the default — sells at the product's prices, and null under update_mask goes back to them.
image_media_idsThe ids of the media items that picture the variant, in their order — the first is the main one. Each once, at most 20, every one of the website's media library. Empty — the default — shows the product's pictures, and their alt text is the product's. Replaced whole when sent; null under update_mask empties it. Deleting a media item takes it off every variant it pictures.
is_activeWhether the variant is on sale. true when omitted. One switched off stays the product's, counted in its variant_count but in no price range.
weightThe variant's weight in the website's unit of weight, general.catalog.weight_unit: a decimal string from 0 to 1000000 with at most three digits after the point, returned in its shortest form ("1.25"). A JSON number is taken on a write too. Absent — not known; null under update_mask clears it.
lengthThe variant's length in the website's unit of length, general.catalog.dimension_unit: a decimal string as weight's, from 0 to 1000000, at most three digits after the point. Absent — not known; null under update_mask clears it.
widthThe variant's width in the website's unit of length, general.catalog.dimension_unit, written as length. Absent — not known; null under update_mask clears it.
heightThe variant's height in the website's unit of length, general.catalog.dimension_unit, written as length. Absent — not known; null under update_mask clears it.
effective_pricesWhat the variant sells at, currency by currency: its own entry, or else the product's. Empty when neither has one. Kept by the server.
effective_image_media_idsThe pictures the variant is shown with: its own image_media_ids, or else the product's. Kept by the server.
Batch create (catalog variants)
Adds many variants to the product in one call: {"requests": [{"variant": {...}}, ...]}, up to 1000, each written exactly as the body of a single create. Every entry is checked before any is written — a refused one answers for the whole call on its own fields (requests[2].variant.sku), and nothing is written. Two entries with the same option_values or sku are INVALID_ARGUMENT; values or an sku stored already, ALREADY_EXISTS; more than 10000 variants in all, FAILED_PRECONDITION. "replace_default_variant": true deletes the product's default variant in the same call, its SKU free for the new ones — how a product without options gets its variants. The default variant alone — one entry, "option_values": {} — is taken on a product with options too: the way back to it before its other variants are deleted. Answers {"variants": [...]} in the requests' order.
path Parameters
website_idId of the parent website.
product_idId of the parent product.
Batch create (catalog variants) › Request Body optional
Batch create (catalog variants) › Responses
The affected resource, or the method’s own response object (§10).
Batch delete (catalog variants)
Deletes many variants of the product in one call: {"variant_ids": ["...", ...]}, up to 1000. An id the product does not have answers NOT_FOUND and deletes nothing; taking every variant the product has answers FAILED_PRECONDITION — a product keeps at least one. Answers {}.
path Parameters
website_idId of the parent website.
product_idId of the parent product.
Batch delete (catalog variants) › Request Body optional
Batch delete (catalog variants) › Responses
The affected resource, or the method’s own response object (§10).
Batch update (catalog variants)
Changes many variants of the product in one call: {"requests": [{"variant_id": "...", "update_mask": "prices,is_active", "variant": {...}}, ...]}, up to 1000, each merged as a single update would merge it — option_values refused, null under its update_mask going back to the product's prices or pictures. A variant named twice is INVALID_ARGUMENT, one the product does not have NOT_FOUND; every entry is checked before any is written, and nothing is written when one is refused. Answers {"variants": [...]} in the requests' order.
path Parameters
website_idId of the parent website.
product_idId of the parent product.
Batch update (catalog variants) › Request Body optional
Batch update (catalog variants) › Responses
The affected resource, or the method’s own response object (§10).