Backend API
Update an existing product using the ID that was returned when created. Updating performs a merge operation. To explicitly override values such as arrays, use the $set operator.
Arguments
Unique identifier for the variant.
The id of the parent product.
An active variant is visible to customers in a storefront, otherwise it will be hidden from view.
An object containing custom attribute values. Overrides product attributes. See attributes for more details.
Human-friendly name of the variant. Defaults to the combined name of all options, for example, "Blue, Large" in the case of 2 options; color and size.
List price used by default when sale=false or sale_price is not defined. Overrides product price.
A variant is automatically archived when it has been sold in the past and product options are changed in a way that would cause the variant to be removed.
Cost of goods used to calculate gross margins. Overrides product cost.
List of images depicting the variant.
A brief description of the image.
An object representing the image file.
A reference to the raw file data.
Optional file name.
Price rules to override price and sale_price when conditions match quantity or account group in a cart. Overrides product prices.
Price applied when conditions are met.
Customer account group as a condition to apply price.
Maximum quantity as a condition to apply price.
Minimum quantity as a condition to apply price.
Indicates the variant is on sale and sale_price is used by default when the product is added to a cart. Overrides product sale.
Sale price used by default when sale=true, overriding price. Overrides product sale price.
If specified, shipping is calculated based on this shipping weight. Otherwise it will assume 1 lb/oz/kg depending on your default weight unit. Overrides product shipping weight.
Stock keeping unit (SKU) used to track inventory in a warehouse.
const { swell } = require('swell-node');
swell.init('store-id', 'secret-key');
await swell.put('/products:variants/{id}', {
id: '5c8fb5e1ed2faf8c79da492a',
price: 19.98,
});
Response
{
"id": "5c8fb5e1ed2faf8c79da492a",
"parent_id": "5ca24abb9c077817e5fe2b36",
"name": "Blue, Small",
"active": true,
"currency": "USD",
"date_created": "2019-04-01T00:00:00.000Z",
"date_updated": "2019-04-01T00:00:00.000Z",
"price": 19.98
}