fixed WC_Product_Variable::set_stock() compatibility with WC_Product::set_stock()

This commit is contained in:
claudiosmweb 2014-05-10 17:45:14 -03:00 committed by Mike Jolley
parent a059290fa8
commit b1207d8eda
1 changed files with 8 additions and 7 deletions

View File

@ -79,14 +79,15 @@ class WC_Product_Variable extends WC_Product {
* Set stock level of the product. * Set stock level of the product.
* *
* @param mixed $amount (default: null) * @param mixed $amount (default: null)
* @param string $mode can be set, add, or subtract
* @return int Stock * @return int Stock
*/ */
function set_stock( $amount = null ) { function set_stock( $amount = null, $mode = 'set' ) {
// Empty total stock so its refreshed // Empty total stock so its refreshed
$this->total_stock = ''; $this->total_stock = '';
// Call parent set_stock // Call parent set_stock
return parent::set_stock( $amount ); return parent::set_stock( $amount, $mode );
} }
/** /**