shopp_product_set_stock ( $product, $stock, $action ) @param int $product (required) The Product id to set stock/stock level on, or the Price object to change. If Price object is specified, the object will be returned, but not saved to the database. @param int $stock (optional default=0) The stock number to adjust/set the level to. @param string $action (optional default=adjust) 'adjust' to set the product stock without setting the stock level, 'restock' to set both the product stock and stock level @return bool true on success, false on failure
adjust stock or set stock level on a product.
This function uses shopp_product_variant_set_stock().
The stock level effects low stock warning thresholds, as well as prevents out of stock items from being purchased.
Stock versus Stock Level
In Shopp 1.2, instead of a flat figure where low stock is indicated across all products, there is a low stock percentage, which will base low stock on the ratio of the current stock to the product’s stock stock level. For instance, if the the low stock threshold is 50% and the stock level is set to 20, low stock warning will appear when the product has less than 10 items.
// set the stock and stock level to 15 for product 5 shopp_product_set_stock ( 5, 15, 'restock' );