public function validate_props()
{
// Before updating, ensure stock props are all aligned. Qty and backorders are not needed if not stock managed.
if (!$this->get_manage_stock()) {
$this->set_stock_quantity('');
$this->set_backorders('no');
// If we are stock managing and we don't have stock, force out of stock status.
} elseif ($this->get_stock_quantity() <= get_option('woocommerce_notify_no_stock_amount')) {
$this->set_stock_status('outofstock');
// If the stock level is changing and we do now have enough, force in stock status.
} elseif ($this->get_stock_quantity() > get_option('woocommerce_notify_no_stock_amount') && array_key_exists('stock_quantity', $this->get_changes())) {
$this->set_stock_status('instock');
// Otherwise revert to status the children have.
} else {
$this->set_stock_status($this->child_is_in_stock() ? 'instock' : 'outofstock');
}
}