Hi Dynamicweb,
We have encountered a limitation in ProductStockNotificationService that makes it difficult to customize the standard back-in-stock notification behavior.
The method below is currently defined as:
internal virtual IEnumerable<ProductBackInStockNotification> GetByIds(IEnumerable<int> ids)
{
return Array.Empty<ProductBackInStockNotification>();
}
This method is used from the frontend flow here:
var stockNotifications = Services.ProductStockNotifications.GetByIds(ids).ToList();
The issue is that the method is internal virtual, which means it cannot be overridden from a custom project, even if we replace ProductStockNotificationService through DI and inherit from the class.
In practice, this makes it impossible to customize the lookup logic for notification IDs in an extension-friendly way, because:
- the method is not accessible outside the Dynamicweb assembly
- using new does not help, since the call is made through the base type
- the frontend code will therefore always hit the default implementation
We would like to request that this method be changed to public virtual (or alternatively protected internal virtual if that fits the intended design better).
This would make it possible to provide a custom implementation of ProductStockNotificationService and override the behavior in a supported way, without patching Dynamicweb source code.
Thanks in advance.
Best regards, Anders