Developer forum

Forum » Development » CheckoutDone being run twice per order

CheckoutDone being run twice per order

Anders Ditlevsen
Anders Ditlevsen
Reply

Hello.

I have a scenario where i have a NotificationSubscriber: Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.CheckoutDone, which is being run twice, whenever i complete the checkout.

I am using a DW9 Wrap, where i have added the above described Subscriber. I am using the standard setup checkout/cart etc that comes with the wrap. However when i complete the order in the frontend the CheckOutDone is run twice. This was confirmed by adding a debugger to the solution prior to completing the order. Something in the log also indicates that it was run twice:

"

Tue, 01 Aug 2017 11:41:21 Order Called CheckoutDone (pageID:0)  
Tue, 01 Aug 2017 11:42:55 Order Order is complete  
Tue, 01 Aug 2017 11:42:55 Order Inside mail loop  
Tue, 01 Aug 2017 11:42:55 Order Customer mail  
Tue, 01 Aug 2017 11:43:01 Order Redirecting to http://frederiksen.integration.test/Default.aspx?ID=8402&CompletedOrderId=ORDER727&CompletedOrderSecret=2f268b7d83054383b22f19bed18c4571  
Tue, 01 Aug 2017 11:52:07 Order Removing cart from session  
Tue, 01 Aug 2017 11:52:07 Order Getting completed order from url  
Tue, 01 Aug 2017 11:52:07 Order Previous step: 1  
Tue, 01 Aug 2017 11:52:07

Order Order is complete, next step is the first step after checkout: 2

"

Is the order completed twice here or have i misinterpreted the log messages?

Any idea why the checkoutDone what could cause the checkoutDone to be run twice?


Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

CheckoutDone can be executed more times if you are using a payment gateway - once for the receipt and once for the callback of the payment gateway.

You could switch to CheckoutDoneOrderIsComplete which should be a better option in most cases - and should be executed only once.

BR Nicolai

Votes for this answer: 1
 
Anders Ditlevsen
Anders Ditlevsen
Reply

Comment: The large gap in time, is due to me debugging in the code during the second executing of the notification subscriber

 

You must be logged in to post in the forum