Videos

Commerce Stock

Date Published: 
12/24/2011
Duration: 
09:01

Commerce Stock is a great demonstration of how Drupal Commerce can be extended with great Drupal 7 features. It adds an integer field for "stock" to a product, and then manages that using rules.

To use Commerce Stock, just enable the module and then visit admin/commerce/config/stock to configure which product types it should be configured for. At this point, a stock field will be added to your products and you can set the initial stock value.

Now, whenever a product is checked out, the stock level will be decremented, and if it reaches zero, the add-to-cart button will be disabled.

Some details:

* You can change when stock is decremented by using your own rule instead of the default rule. The default rule decrements stock "when completing the checkout process" but you might want to do it when an order is complete or when it is shipped.
* Commerce Stock currently does not currently attempt to deal with purchase collisions (two customers purchasing the same product at the same time).
* Version 7.x-1.x is not transactional, and does not have a log of when or why the stock was changed, but 7.x-2.x promises new capabilities (see the project page).
* You can easily add the stock field to any view of products you use to see current stock levels.

Terms to link to Blog Posts: