Try our conversational search powered by Generative AI!

Unpublish product without deleting it



How can I unpublish a product without deleting it? Should I set it's status? And what SaveAction should I use?

Edited, Sep 13, 2016 9:35


I think you can set the StartPublish and/or StopPublish to make it "not available". Here's an example code:


var content = CurrentContent.CreateWritableClone<EntryContentBase>();
content.StopPublish = DateTime.UtcNow.AddDays(-1);
contentRepo.Save(content, SaveAction.Publish, AccessLevel.NoAccess);
Sep 13, 2016 10:21

Hi Quan!

Epi_IsPublished will still be true since you use SaveAction.Publish though. But maybe StartPublish and StopPublish will prevent it from showing?

Sep 13, 2016 13:17

There is no true way to unpublish a catalog content using content APIs (or at least what I know of). Setting StartPublish to be after current time means it's yet to available, while setting StopPublish to the past means it's expired. It then depends on your front-end code to filter out those entries from being shown.

You can still set IsActive column via CatalogEntryDto and/or setting metaObject["Epi_IsPublished"] to false via MetaObject.


Sep 13, 2016 14:48

Okay. I think in previous versions of EPi, I could set IsPendingPublish to true, which would set IsActive to false on the CatalogEntry. Is this still the case?

Sep 14, 2016 10:48

I would recommend to set the StopPublish to the current UTC time and that way expire the content.

It would require you to filter out content upon loading using the IPublishedStateAssessor.IsPublished function, but that is something you should already be doing. :)

Sep 15, 2016 16:03
* 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.