Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Commerce 14 (.Net5) - a draft is created when creating a language branch

Vote:
 

Hi,

I'm working with making an integration for importing products from an external system into Optimizely programatically. For some reason when I'm saving a language branch for a Category in Commerce, it is also creating a draft for the category (same issue occurs with products and variants).

Both the masterLanguage (en) and the secondary language branch (sv) are created using IContentRepository like so:


//save master language 
var newContentRef = _contentRepository.Save(catalogContent, SaveAction.Publish | SaveAction.ForceCurrentVersion, AccessLevel.NoAccess);

var langBranch = _contentRepository.CreateLanguageBranch<CatalogContentBase>(newContentRef.ToReferenceWithoutVersion(), CultureInfo.GetCultureInfo(lang));
// here is some custom logic for updating some custom properties in langBranch

//saves swedish language branch
 _contentRepository.Save(langBranch, SaveAction.Publish | SaveAction.ForceCurrentVersion, AccessLevel.NoAccess);

I would like it if no draft was created in the language branch when it is created if possible. Am I doing something wrong or is this a bug in commerce? Thank you!

#276324
Edited, Mar 14, 2022 14:25
Vote:
 

I've also noticed the following warning logs when saving my language branch:

2022-03-14 15:11:40.643 +01:00 [WRN] Non culture-specific property Categories is changed in language sv, which is not the master language. The change will not be saved to database.
2022-03-14 15:11:44.812 +01:00 [WRN] Non culture-specific property Categories is changed in language sv, which is not the master language. The change will not be saved to database.

Could this be the cause behind this strange behaviour? From what I can tell these are internal properties of EPiServer.Commerce.Catalog.ContentTypes.EntryContentBase. Shouldn't the value of the Categories property be the same for a newly created language branch?

#276325
Edited, Mar 14, 2022 14:51
* 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.