Skip to main content
Published: May 11 2012, 3:33:00 PMUpdated: November 28 2020, 10:28:52 PM

In MIP we can place an  item in custom store category


PRODUCT.StoreCategories = ["123465789"];.

What do we need to do when we actually want to remove the item from that category at a later point in time because it is no longer featured?

Ans : Just don't set the StoreCategory, in other words skip the cats.push. Just use a flag from the Product feed to check if the current Product should be placed in Custom Store category or nor. Simple implementation would sending in the custom store category as PRODUCT.CustomStoreCat.

Esentially your code snippet would be:

var CustomStoreCat= PRODUCT_INRECORD.CustomStoreCat;
if(!isEmptyOrNull(CustomStoreCat)) //if CustomStoreCat coulumn is NOT null or not Empty.
LOGGER.log("> Item is selected for Store category: '"+Featured+"'");

PRODUCT.StoreCategories = ["CustomStoreCat "];.

}else{//if CustomStoreCat coulumn is null or Empty or not found.
//remove the category!
// Dont do anything, also its a good practice to log a message:)
LOGGER.log("CustomStoreCat is null, So not setting the custome store category ,(or removing Custom Store Category for previously set product )");

Note that PRODUCT.StoreCategories = [] or PRODUCT.StoreCategories = null or PRODUCT.StoreCategories = [null] is not the same as not setting it. So please donot use any of these statements.

How well did this answer your question?