Modifying variations
To modify a variation, you must perform the following:
- Get an instance of the catalog manager.
Get an instance of the CatalogManager object.
- Get the specified variation.
Get an instance of the variation. For more information, read Querying variations.
- Modify the instance of the variation.
Update the values of the properties of the variation.
- Save the changes.
Save the changes to the manager.
Here is a code example:
public static void ModifyVariation(Guid variationId, decimal newAdditionalPrice)
{
CatalogManager catalogManager = new CatalogManager();
ProductVariation variation = catalogManager.GetProductVariation(variationId);
if (variation == null)
{
return; //Variation does not exist.
}
variation.AdditionalPrice = newAdditionalPrice;
catalogManager.SaveChanges();
}