SaaS CMS has officially launched! Learn more now.

Change MetaClass of CatalogEntry Object Programmatically



I need to convert my CatalogEntry object from Metaclass A to B. I can do this in CommerceManager but couldn't find any way to do this programmatically. I need to do this without creating a new CatalogEntry. What would be the best way to do this? Or is there any other way to do this in Commerce that could also help? Thank you.

Aug 16, 2023 14:40

Unfortunately changing the metaclass is a not very well thought feature in Commerce Manager and it can cause unforseenable consequences. If you still want to proceed, in theory you can change the MetaClassId of an EntryContentBase (or NodeContent).

I recall that the catalog content system explicitly check to refuse changes in MetaClassId, but I can't seem to find that check in code now. Maybe I remember it incorrectly, or it was removed at some point. 

Aug 17, 2023 6:23
abdulkadir.erkmen - Aug 17, 2023 12:24
with following Commerce Manager changes in database I created a similar sql script, if I change data, remove old meta properties and add new meta properties would it work?

Hi Quan,

Thank you for your reply. I actually try to change the MetaClassId of an EntryContentBase but it didn't work, it stays as the old MetaClass even after the update. Probably like you said there is a discarding MetaClass changes flow. I will move forward with other options, then thank you.

Aug 17, 2023 7:36
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.