wp-e-commerce / WP-e-Commerce

WP eCommerce - The most popular independent eCommerce platform for WordPress
https://wpecommerce.org
GNU General Public License v2.0
215 stars 216 forks source link

Inventory/Stock not updating correctly, on orders immediately following a failed transaction by the same user.. #995

Open jberg1 opened 10 years ago

jberg1 commented 10 years ago

My issue comes when an initial order is denied for whatever reason, then completed immediately after by the same user. If the order is rejected the system creates an Incomplete Order, then the user is redirected to try again. When the same user is then successful in checkout immediately after the rejected order the system creates an Accepted Payment order (with a different order #), but at this point it doesn't reduce the stock for the successful order.

If an order is completed successfully the first time, the stock is reduced correctly. This may have something to do with the claimed stock not being cleared for the rejected order. Is there a way to disable the temporarily claimed stock completely to test?

WP-Ecommerce Version: 3.8.12.1 WP Version :3.8.1 Payment Gateway: PayPal Pro 2.0

JustinSainton commented 10 years ago

Hi @jberg1,

Interesting issue here. The tricky part here is that an "Incomplete Order" isn't necessarily the same thing as a rejected order. For example, if you use PayPal - while you're at PayPal finishing the order, but have not yet paid for it. That's a scenario where the order is logged as Incomplete.

In that scenario, it would not be good to have the stock management disabled. But in the scenario you described, where you have two orders logged, one being incomplete - in your testing, it would appear that the stock is never actually decremented.

I'm going to ping @benhuson and @JeffPyeBrook to take a look at this. There are a few other stock management bugs that I think would be awesome to get resolved in this release, if at all possible, and this sounds like a great candidate - assuming we can reproduce the issue.

jberg1 commented 10 years ago

Hey Justin, Thanks for the feedback. It would be nice to figure this one out. For the website I'm working with we have Paypal Pro as the gateway (using the Gold Cart upgrade), so the user never leaves the site for payment. They just enter the CC# at the bottom of the checkout screen. I'm unclear on why the order is rejected the first time in some cases (maybe user entering incorrect CC info or Paypal unhappy with some of the info.). I just know the user gets a message saying something like the payment info was rejected and to try again. This scenario creates the incomplete order on the back-end, followed by an accepted order after they try again.

When we find issues with the stock levels being off on a product they are always traced back to an order that was proceeded by an "incomplete order" by the same user. Based on other products in that order that didn't have their stock reduced. The orders proceeded by an incomplete order by the same user, don't reduce the stock for any items in that order.

Just thought disabling the temporary claim on stock when it is added to the shopping cart might verify if that is truly the issue. Just for testing sake, without knowing exactly how this works. I was thinking maybe the temporary claim is putting stock back after the expiration of the shopping cart for the incomplete order (admittedly this grabbing at straws to find a solution).

Thanks for any solution you might find.

benhuson commented 10 years ago

I've also been experiencing a lot of that PayPal rejected order message recently and think it may be to do with billing/shipping details - that requires more investigation separate to the stock issue.

My assumption to what might be happening is after a user clicks through to pay, they get an error and use there browser back button to go back to checkout, then try again. I'm guessing that after using the back button something is happening to make the claimed stock and the new order that is generated on the next attempt be disassociated from each other - just a hypothesis at the moment.

If you get an Incomplete Order in the admin, that will still have claimed stock associated with it until you change it's order status to complete or closed which will free up that stock (I think).

JustinSainton commented 10 years ago

Punting to 3.9.0 for now. I really want to have a release to focus on the stock management in general. Lots of little bugs with stock management that would be great to get resolved.