The /atg/commerce/order/abandoned/AbandonedOrderService not only defines what constitutes an abandoned or lost order, but also queries the order repository for these types of orders according to the schedule that you specify in its schedule property. The default schedule is “every day at 3:00 AM.”

When an AbandonedOrderService job is run, the service queries the order repository for both abandoned and lost orders. The following table lists the criteria orders must meet to be identified as abandoned or lost:

Criteria for Identification as “Abandoned”

Criteria for Identification as “Lost”

The order’s state matches one in the AbandonedOrderTools.abandonableOrderStates property.

Same

The abandonment state is REANIMATED.

The abandonment state is not LOST.

The order has been idle for the number of days specified in the AbandonedOrderService.idleDaysUntilAbandoned property.

The order has been idle for the number of days specified in the AbandonedOrderService.idleDaysUntilLost property.

The order’s subtotal is greater than or equal to the amount specified in the AbandonedOrderService.minimumAmount property, if set.

Same

See Configuring AbandonedOrderTools and Configuring AbandonedOrderService for information on setting the properties referenced in the table above.

For each abandoned order found, the AbandonedOrderService does the following:

  1. Adds the order to the list of abandoned orders in the user’s abandonedOrders profile property.

  2. If necessary, creates an abandonmentInfo item for the order; then updates the item with the relevant information:

    • The state property is set to ABANDONED.

    • The abandonmentDate property is set to the current date and time.

    • If the abandonmentInfo item is new, the abandonmentCount property is set to 1. Otherwise, it is incremented.

  3. Fires an OrderAbandoned message if the AbandonedOrderTools.sendOrderAbandonedMessage property is set to true.

For each lost order found, the AbandonedOrderService does the following:

  1. Removes the order from the list of abandoned orders in the user’s abandonedOrders profile property.

  2. If the AbandonedOrderTools.deleteLostOrders property is set to true, the lost order is deleted from the order repository.

  3. If the AbandonedOrderTools.leaveAbandonmentInfoForDeletedOrders property is set to true, the abandonmentInfo item for the order is updated with the relevant information:

    • The state property is set to LOST.

    • The lostDate property is set to the current date and time.

  4. Fires an OrderLost message if the AbandonedOrderTools.sendOrderLostMessage property is set to true.

As previously mentioned, the AbandonedOrderService is a configured instance of class atg.commerce.order.abandoned.AbandonedOrderService. This class extends atg.service.scheduler.SingletonSchedulableService, which uses locking to enable multiple servers to run the same scheduled service while ensuring that only one instance performs the scheduled task at a given time.