1

I am using Sitecore XC 9.1 and want to programmatically trigger a update of the Commerce data templates. This will, for example, be handy in my CI setup.

How to do this?

1 Answer 1

2

Use the CatalogTemplateGenerator class to perform the desired actions, e.g. to delete and build:

var master = Sitecore.Configuration.Factory.GetDatabase("master");
var generator = new Sitecore.Commerce.Engine.Connect.DataProvider.Templates.CatalogTemplateGenerator();

generator.DeleteAllGeneratedTemplates(master);
generator.BuildCatalogTemplates(master);

NB. the GUI triggers this code by Sitecore.Commerce.Engine.Connect.DataProvider.Commands.GenerateTemplatesCommand.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.