StockStatus and StockDetailsLevel Entities

The StockStatus and StockDetailsLevel entities are slightly different from traditional entities, in that they are intended to represent enumeration values. StockStatus represents a standard enumeration, and StockDetailsLevel represents a flags enumeration.

If either of these entities need to be extended for an ECS, the extended entities must also expose constants/read-only properties that represent the possible values for the entity. For example, if extending StockStatus to contain a new Downloadable value, then the extended EcsStockStatus entity should expose a staticreadonly field that represents the Downloadable value (that is, public static StockStatus Downloadable = new EcsStockStatus(5, “Downloadable);)

The InventoryProductBuilder class is a helper class used in the inventory system to build InventoryProduct entities based on the current site context, compare InventoryProduct entities, and so on. If you extend the InventoryProduct entity, this class also needs to be extended. Configuration for the InventoryProductBuilder is located in configuration at sitecore/inventoryProductBuilder.

The InventoryAutomationProvider class is a helper class used by the conditions and actions in the Products Back in Stock engagement automation plan to access automation state data as strongly-typed classes. Automation state data in the inventory system is stored as JSON serialized strings. The InventoryAutomationProvider class is responsible for serializing and deserializing information stored in the automation state data row.

Products Back in Stock Engagement Plan

The plan is provided as a branch template and multiple instances can be created. Create one instance per shop.  You can customize the default plan with different or more states as is needed. Its purpose is to notify customers by email message when a product they are interested in is back in stock and available for order.

This automation plan maintains state data that is serialized in JSON format. The following values are used to track customer back-in-stock notification requests, all of which represent a list of StockNotificationRequest objects:

  • commerce.productNotifications

    Contains the list of valid notification requests that the customer is interested in.

  • commerce.expiredNotifications

    Contains the list of notification requests that have expired.

  • commerce.backInStockProducts

    Contains the list of products that are back in stock.

To support this automation plan, two new conditions and two actions have been created.

  • Action: Remove Expired Back In Stock Notifications

    This action updates the automation plan state data, and removes the back-in-stock notification requests that are past their interest date. The default interest date is 180 days after the day the customer requested to be notified when a product is back in stock.

  • Action: Send Back In Stock Notification Email

    This action sends an email message to the customers when a product they are interested is back in stock. Customize this action for each shop to contain the correct email address and email body branding.

  • Condition: Are Products Back In Stock Condition

    This condition checks if any products that customers are interested in are back in stock. If at least one product is back in stock, this condition will evaluate as true.

  • Condition: Has List Of Visitor Notifications Expired Condition

    This condition checks if the customer still has any valid back-in-stock’ notification requests. If at least one back-in-stock notification request exists that has not expired, this condition will evaluate to false.

All of these conditions and actions rely on the InventoryAutomationProvider class to access automation state data and perform notification comparisons. So, customizing the conditions and actions directly is not necessary. Instead, you can update the InventoryAutomationProvider class to extend any functionality needed in this automation plan.