You're viewing the documentation of an older Simple Commerce version. Consider upgrading to the latest for new features and bug fixes.

Stock

  1. # Events

To start using the stock functionality built into Simple Commerce, you'll need to add an Integer field, with the handle of stock to your product blueprint.

After that, you can populate your products with the correct amount of stock. Then, whenever a customer purhcases something on your store, the quantity of each product will be subtracted from the product's stock.

Events

Simple Commerce includes two events to do with stock: StockRunningLow and StockRunOut. They will be dispatched when the stock on one of your products is running low or has indeed run out.

You can configure the threshold for when you want to start dispatching the StockRunningLow event in your config/simple-commerce.php file.

1/*
2 |--------------------------------------------------------------------------
3 | Stock Running Low
4 |--------------------------------------------------------------------------
5 |
6 | Simple Commerce can be configured to emit events when stock is running low for
7 | products. Here is where you can configure the threshold when we start sending
8 | those notifications.
9 |
10*/
11 
12'low_stock_threshold' => 25,
Last updated 3 months ago Improve this page on GitHub!