This code is from the entry point file of the cust...
# suitecommerce
z
This code is from the entry point file of the custom extension if (pdp) { pdp.on('beforeShowContent', function () { let itemInfo = pdp.getItemInfo(); if (itemInfo.item.matrixchilditems_detail) { layout.addToViewContextDefinition('ProductViews.Option.View', 'matrixImages', 'array', function (context) { //Some Logic here return arrToReturn; }); } }); } I am getting this error in the console while redering to PDP from PLP and page is not redirecting. "Exception on event handler for event beforeShowContent DUPLICATED_CONTEXT_PROPERTY: Duplicated propertyName. Trying to add more than one extra context property with the same name" Any help would be appreciated
s
Because you're triggering this with a beforeShowContent, so every time showContent() is called, it is calling this function. This method should only be called once, so it is returning the error because you keep calling it.
z
Okay i understand but what if want to add the the context property to the PDP page of the site if i remove the beforshowcontent event how can i add this to the PDP ?