Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / Two people have one-of-a-kind item in cart - both can checkout

Two people have one-of-a-kind item in cart - both can checkout

23 Sep 2015, 2:44 PM
#1
eyeb avatar

eyeb

New Zenner

Join Date:
Aug 2013
Location:
United States
Posts:
37
Plugin Contributions:
0

Post #1 by eyeb

Hello,

We sell one-of-a-kind items. There is often only 1 available and when it is gone there is no backordering. We have inventory control so once something is bought it is off the site - all good there. But two people (or more) can add the same item to their cart if the item is still available - which is also good because someone may not checkout - so we don't want the item to be gone after it's been added to a cart. So two people can add an item to their respective carts - the first to checkout gets the item BUT the other person who had the item in their cart also can checkout...but of course the item isn't available anymore...unhappy customer, we have to take time to get their refund, etc.

Is this a common scenario?

Is this hard to solve?

Ideas of solving?

Thanks so much. :smile:

23 Sep 2015, 3:08 PM
#2
lruskauff avatar

lruskauff

Totally Zenned

Join Date:
Sep 2008
Location:
WA
Posts:
559
Plugin Contributions:
0

Post #2 by lruskauff

Zencart should prevent the second person from paying for it. The shopping cart will give a message that this item is no longer available. Or are you saying that this actually happened?

23 Sep 2015, 3:41 PM
#3
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Post #3 by stevesh

This question comes up every now and then. There are only two possible options: 1) remove the item from inventory when it's placed in the cart, which, since many people place products in their carts just as a reminder and may well remove it before checking out, you could lose a sale when the item isn't available to someone else, or 2) remove the product from inventory on checkout (the current Zencart process) which avoids the problem above, but creates the one you're asking about. Most Zenners don't sell one-of-a-kind products, so Zencart's choice provides the greatest good for the greatest number.

I believe lruskauff is correct - once the first buyer has checked out, the second buyer shouldn't be able to pay for the now-out-of-stock item.

23 Sep 2015, 3:58 PM
#4
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #4 by mc12345678

While I also think (not tested/proven) that ultimately the funds should not be collected/committed if the second person missed out, it may also help to identify the payment method involved if the OPed situation does occur. There may be a check that is missed at time of committing the funds to the processor.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

23 Sep 2015, 4:13 PM
#5
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,156
Plugin Contributions:
56

Post #5 by lat9

What's the value for Configuration->Stock->Allow Checkout? In the OP's case, it should be set to false.

23 Sep 2015, 11:57 PM
#6
gilby avatar

gilby

Totally Zenned

Join Date:
Aug 2005
Location:
Vic, Oz
Posts:
1,816
Plugin Contributions:
0

Post #6 by gilby

stevesh:

This question comes up every now and then. There are only two possible options: 1) remove the item from inventory when it's placed in the cart, which, since many people place products in their carts just as a reminder and may well remove it before checking out, you could lose a sale when the item isn't available to someone else, or 2) remove the product from inventory on checkout (the current Zencart process) which avoids the problem above, but creates the one you're asking about. Most Zenners don't sell one-of-a-kind products, so Zencart's choice provides the greatest good for the greatest number.

I believe lruskauff is correct - once the first buyer has checked out, the second buyer shouldn't be able to pay for the now-out-of-stock item.
I wonder what happens if 2 customers have it in their card and go to say Paypal to finish the payment.
The first to finish and return to the cart completes the checkout, gets the item and NO other customer can get the item.
However what happens when the other customer completes the payment, all good, and then returns to the cart. The item is now NO longer available, (but the payment has been made)?

This customer could NOT start payment if the other customer had completed their transaction.
But as it could take a few minutes to process at Paypal (or another processor) It seems that the second payment could be made successfully and then when it returns to the cart the item is NO longer available.
I can see that this second payment would have to be refunded.
Not sure what the sale in the website would look like!
Would the item be shown (incorrectly) as sold?
or would nothing be in the order (despite payment being made)?

24 Sep 2015, 3:49 PM
#7
eyeb avatar

eyeb

New Zenner

Join Date:
Aug 2013
Location:
United States
Posts:
37
Plugin Contributions:
0

Post #7 by eyeb

Hello,

Thanks for all the replies. I do have Configuration > Stock > allow checkout set to false. The culprit seem to be my Stock By Attributes module - sorry I didn't mention that in my OP. When I order/pay for an item it does remove it from other carts - but when using the Stock By Attributes it does not and you can still checkout. While this isn't an issue for all our products it is an issue for many of them (shoes - that there are only one pair of for each size). I'll see if I can contact the module developer...but if anyone has any idea here to please post. Again thanks for replies so far.

24 Sep 2015, 4:02 PM
#8
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #8 by mc12345678

eyeb:

Hello,

Thanks for all the replies. I do have Configuration > Stock > allow checkout set to false. The culprit seem to be my Stock By Attributes module - sorry I didn't mention that in my OP. When I order/pay for an item it does remove it from other carts - but when using the Stock By Attributes it does not and you can still checkout. While this isn't an issue for all our products it is an issue for many of them (shoes - that there are only one pair of for each size). I'll see if I can contact the module developer...but if anyone has any idea here to please post. Again thanks for replies so far.

Depends and considering the history of Stock by Attributes,what is the source of the version you have installed and when was it last installed/updated?

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

24 Sep 2015, 8:04 PM
#9
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #9 by mc12345678

gilby:

I wonder what happens if 2 customers have it in their card and go to say Paypal to finish the payment.
The first to finish and return to the cart completes the checkout, gets the item and NO other customer can get the item.
However what happens when the other customer completes the payment, all good, and then returns to the cart. The item is now NO longer available, (but the payment has been made)?

This customer could NOT start payment if the other customer had completed their transaction.
But as it could take a few minutes to process at Paypal (or another processor) It seems that the second payment could be made successfully and then when it returns to the cart the item is NO longer available.
I can see that this second payment would have to be refunded.
Not sure what the sale in the website would look like!
Would the item be shown (incorrectly) as sold?
or would nothing be in the order (despite payment being made)?

Took a look at the code during the checkout process, specifically includes/modules/pages/checkout_confirmation/header_php.php and how it relates to SBA 1.5.4, on line 108 (ZC 1.5.2, 1.5.3, and 1.5.4) there is a check that looks like it needs to be modified slightly. This file will get incorporated into the SBA code, but can be easily changed here.

Change:

    if ($stock_check[$i] = zen_check_stock($order->products[$i]['id'], $order->products[$i]['qty'])) {

to: by adding , $order->products[$i]['attributes'] into the zen_check_stock statement:

    if ($stock_check[$i] = zen_check_stock($order->products[$i]['id'], $order->products[$i]['qty'], $order->products[$i]['attributes'])) {

Without this additional attribute information, then the stock check is made against the base product instead of the SBA tracked quantity. Thus if the product had two attributes each being tracked, if say they both had a quantity of 1, then during the above situation of two people each adding the same attributed product to the cart and "racing" to purchase, well the quantity check would have indicated that there was still one product left, but wouldn't account for having 0 products matching that attribute... With the above, that issue should be resolved.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...