Create a modifier
POSThttps://euwest.api.elasticpath.com/pcm/variations/:variationID/options/:optionID/modifiers
You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product.
The table below describes the different types of modifiers.
Modifier | Data Type | Effect |
---|---|---|
name_equals | string | Overrides the name of the child product with the name specified by the modifier. |
name_append | string | Appends the string specified in the modifier to the name of the child product. |
name_prepend | string | Prepends the string specified in the modifier to the name of the child product. |
description_equals | string | Overrides the description of the child product. |
description_append | string | Appends the string specified in the modifier to the description of the child product. |
description_prepend | string | Prepends the string specified in the modifier to the product description of the child product. |
commodity_type | string | Sets the commodity type of the child product, such as physical or digital . |
price | string | Allows application of price modifiers (price_increment , price_decrement , and price_equals ) to the child products. |
price_increment | string | Increases the price of the child product. |
price_decrement | string | Decreases the price of the child product. |
price_equals | string | Sets the price of a child product to the amount you specify. |
slug_append | string | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the slug-builder modifier, you can use {} in the seek field, for example, "seek": :{COLOR}" . |
slug_prepend | string | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the slug-builder modifier, you can use {} in the seek field, for example, "seek": :{COLOR}" . |
slug_builder | string | Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the slug-builder modifier, you can use {} in the seek field, for example, "seek": :{COLOR}" . |
sku_equals | string | Sets the SKU of the child product. |
sku_append | string | Appends the string specified in the modifier to the SKU of the child product. |
sku_prepend | string | Prepends the string specified in the modifier to the SKU of the child product. |
sku_builder | string | Sets a part of the SKU of the child product. |
status | string | Sets the status of the child product, such as draft or live . |
Request
Responses
- 201
- 422
- 500
Successfully returns the created modifier
Bad request. The request failed validation.
Internal server error. There was a system failure in the platform.
Authorization: http
name: bearerAuthtype: httpscheme: bearer
- csharp
- curl
- dart
- go
- http
- java
- javascript
- kotlin
- c
- nodejs
- objective-c
- ocaml
- php
- powershell
- python
- r
- ruby
- rust
- shell
- swift
- HTTPCLIENT
- RESTSHARP
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://euwest.api.elasticpath.com/pcm/variations/:variationID/options/:optionID/modifiers");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"data\": {\n \"type\": \"product-variation-modifier\",\n \"attributes\": {\n \"type\": \"commodity_type\",\n \"value\": \"string\",\n \"seek\": \"string\",\n \"set\": \"string\",\n \"reference_name\": \"string\"\n }\n }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
ResponseClear