joaogdesigner
joaogdesigner

Reputation: 440

Magento: Decrease stock after a product is added to cart

I would like to ask for your help to solve a problem. I need to know how to decrease stock not after an order is placed but after the product is added to cart. How can I do this programming? Does anybody have an idea? Yes, I know this is not recommended and it's crazy however I’m working on a development of an online store and the customer (store owner) requested this to my boss and I have to do, simply. Please, anybody could help me with this damn idea?

Thousands of thank you!

Upvotes: 1

Views: 1759

Answers (1)

dagfr
dagfr

Reputation: 2384

Even if I strongly not recommend to do so. Here are some advice.

1°) Create your own module, with an event handler on add_to_cart_after.

This event is fired when you successfully add an item to your cart.

2°) Then look at Mage_CatalogInventory_Model_Observer : subtractQuoteInventory function to see how to decrease stock.

3°) Now you have to alternate this Observer by rewriting to avoid item removed from stock a second time when order is placed.

Upvotes: 1

Related Questions