The function uc_cart_complete_sale is called twice, and therefore the "checkout_complete" workflow event is invoked twice. Which decreases inventory each time.
I believe it is because uc_cart_checkout_complete is called first as a callback from the URL /cart/checkout/complete, which then calls uc_cart_complete_sale.
Then uc_cart_complete_sale is called directly from uc_paypal_ipn (around line 659) when the Instant Payment Notification comes through.
This is a big problem since inventory gets decreased twice, and any other events triggered by checkout_complete (referral bonuses) also happens twice.
I solved this quick and dirty by removing the latter call, but it doesn't seem ideal.



Joined: 07/26/2008