/** * Increase stock level of the product * * @param int $by Amount to increase by */ function increase_stock($by = 1) { global $woocommerce; if ($this->variation_has_stock) { if ($this->managing_stock()) { $this->stock = $this->stock + $by; $this->total_stock = $this->total_stock + $by; update_post_meta($this->variation_id, '_stock', $this->stock); $woocommerce->clear_product_transients($this->id); // Clear transient // Parents out of stock attribute if ($this->is_in_stock()) { update_post_meta($this->id, '_stock_status', 'instock'); } return $this->stock; } } else { return parent::increase_stock($by); } }
/** * Increase stock level of the product. * * @param int $by (default: 1) Amount to increase by * @return int stock level */ public function increase_stock($by = 1) { if ($this->variation_has_stock) { return $this->set_stock($this->stock + $by); } else { return parent::increase_stock($by); } }
/** * Increase stock level of the product * * @param int $by Amount to increase by */ function increase_stock($by = 1) { if ($this->variation_has_stock) { if ($this->managing_stock()) { $this->stock = $this->stock + $by; $this->total_stock = $this->get_total_stock() + $by; update_post_meta($this->variation_id, '_stock', $this->stock); // Parents out of stock attribute if ($this->is_in_stock()) { update_post_meta($this->id, '_stock_status', 'instock'); } return $this->stock; } } else { return parent::increase_stock($by); } }