Try our conversational search powered by Generative AI!

Setting tax category for an variant/sku programatically


I'm building a scheduled job which which creates variants/skus and I'm not sure how to set the tax category for each variant/sku.

Code as follows:

CatalogEntryDto entryDto = CatalogContext.Current.GetCatalogEntryDto(myEntryId, new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.CatalogEntryFull));

            if (entryDto.CatalogEntry.Count > 0)
                CatalogEntryDto.VariationRow[] variationRows = entryDto.CatalogEntry[0].GetVariationRows();

                if (variationRows.Length > 0)
                    CatalogTaxDto categories = CatalogTaxManager.GetTaxCategories();

                    if (categories.TaxCategory.Count > 0)
                        variationRows[0].TaxCategoryId = categories.TaxCategory[0].TaxCategoryId;

It goes through the code and sets the taxcategoryid, but it is not set when I go to that specific variant in Catalogue view. Do I need to save it somehow or set something more than the id? The documentation I find is for getting the values, not for setting, so something is missing here.

Help appreciated.


Mar 10, 2015 11:01


You need to call CatalogContext.Current.SaveCatalogEntry(catalogEntryDto) to save the changes.



Mar 10, 2015 11:57

Great thanks Quan!

Mar 10, 2015 15:56


How do you set tax category  on packages? 



Nov 09, 2017 15:13

We suggest to use the new content APIs, and PackageContent implements IPricing, which has TaxCategoryId property that you can set. 

Nov 13, 2017 15:24

Thanks!  will try it out! 

Nov 13, 2017 16:21
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.