We have a pretty flat product importfile from the customers ERP, and need to unpublish all the variants that are not present in the file.
But to do that we would need all the variants to compare to the contents of the file, so is there any good way of fetching all the published (or just all) variants?
You can also get all the variants by using var templateGuid = FieldTemplateService.Get<ProductFieldTemplate>(typeof(ProductArea), TemplateId) var baseProducts = BaseProductService.GetByTemplate(templateId) ... var variants = VariantService.GetByBaseProduct(baseproduct)
Not the most optimal but this way you got more control of what products but should be cached from what I understand.