Get ShoppingCartItem and OrderItem Ids

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 anni tempo fa
Hi All,

Is it possible to get the ShoppingCartItem Id and OrderItem Id from any nop handle events?

I am trying to implement the IConsumer<OrderPlacedEvent> but I don't see the shoppingcartitem id in this event.

What I'm trying to do is to capture the ShoppingCartItem Id and OrderItem Id and store it into the custom table.

My Custom table would look like this.

Id | ShoppingCartItemId | OrderItemId |
1  | 10                 | 101         |  
2  | 11                 | 102         |  
3  | 12                 | 103         |

If this is not possible, how can I achieve this?


Thank you
6 anni tempo fa
When you handle the event, you can get to the Order, and then the OrderItems, and the Products.  But ShoppingCartItems are gone by then.  (I would think you'd want the Product Ids anyway ;)

        public void HandleEvent(OrderPlacedEvent eventMessage)
        {
            var order = eventMessage.Order;

            var products = order.OrderItems.Select(oi => ... oi.ProductId ...)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.