Hi,

The title says it all. I am wondering if the stock can be decremented when a user adds an item to their cart rather than waiting for them to checkout. If they abandon their cart, stock would need to be returned. I have carts set to expire in one hour.

Could this be achieved by adding a trigger for add to cart / remove from cart?

Willing to fund feature if it is possible.

Thanks!

Jen

Comments

Bryan T’s picture

Issue tags: -Ubercart, -Inventory

I'll second the need for this.

Additional thoughts to Jen's post above:
- Add query to 'Reserve' stock that exists is in carts when AJAX lookup is querying stock.
- Decrement would be done to the actual stock upon completion of checkout as usual.
- Should work with Attributes and Option SKU's.
- Option to display a message notifying the customer that items will be removed from cart if they don't complete checkout after XX:XX minutes.

Requirements:
- All carts should have a duration set to prevent locking up products.

This functionality will be similar to purchasing tickets from a ticket broker (Ticketmaster, Live Nation, etc). When the user initiates their order by adding an item to the cart, the item is 'on hold' for a time period to allow them to checkout. If the user abandons their cart, the cart expires and the held stock is released for others to buy.

Thank you in advance.

Bryan T’s picture

Issue tags: +Ubercart, +Inventory
hanoii’s picture

Project: Ubercart Out of stock Notification » Ubercart
Version: 6.x-1.4 » 6.x-2.x-dev
Issue tags: +Ubercart, +Inventory

This sound not only as a specific feature (which I can see it's use for certain cases), but something that's completely outside the scope of this module. This module does not decrement or handle any kind of stock logic, it only check for the stock amount and notify the user if the item is out of stock and prevent from adding out of stock items to the cart. I am moving this feature to the ubercart issue queue in which it makes more sense, at least for now. Otherwise, a new module will have to be created to accomplish something like that.

Bryan T’s picture

Hanoii, lets just omit the word 'decrement' as that is already handled by checkout. The scope of the module focuses on checking available stock. It seems very possible an option could be added to 'Check for items in carts as well'.

If the customer has an item in their cart, it should be considered "On Hold" as they may be in the process of purchasing. This would of course require all carts to expire in a reasonable time.

I was able to work around the issue and have the module check the product's stock as well as if/how many were in users carts by placing a SQL query in the function. Problem is it only works for the main SKU (using $nid), not attributes or any features.

Any thoughts on performing the stock query on cart items as well?

longwave’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev
Component: Code » Stock
Status: Active » Postponed

Bumping to 7.x-3.x and postponing until after #1298550: Create new 'abandoned' order status. which should solve the problem of locking items in carts that will never be purchased due to abandonment.

tmsimont’s picture

Status: Postponed » Active

The issue referenced in #6 #1298550: Create new 'abandoned' order status. has been fixed so I'm marking this as active again.

A new feature to handle this kind of thing could also resolve this issue:
#1536576: What happens if two users add the same product to their cart?

ratinakage’s picture

Would love to see this ported to D6 :)

TR’s picture

Status: Active » Postponed
Issue tags: -Ubercart, -Inventory

While this can be done, it's only a partial bandage on the real problem that stock handling in Ubercart isn't transactional (which is what #1536576: What happens if two users add the same product to their cart? is starting to touch on). Don't fool yourself into thinking that if only stock could be decremented on add-to-cart then selling unique items would be possible. And because Drupal Commerce has copied Ubercart as far as stock handling, that's not a solution either.

Note there's a muddled meta-issue about fixing stock handing: #384996: Better stock support
There are also a lot of threads on ubercart.org.

Bottom line, this is going to require a major effort in terms of time, so unless someone is in the position to donate their expertise this issue is unlikely to be solved without a sponsor. Because of that, I'm going to move this back to "postponed" until someone steps forward to tackle this.

@ratinakage: Realistically, there's pretty much no chance of that happening at this point.

ratinakage’s picture

Thanks TR!! - Good to know...

TR’s picture

Version: 7.x-3.x-dev » 8.x-4.x-dev
Issue summary: View changes