WC_Product::set_stock_status( string $status = 'instock' )

Set stock status.


Description Description


Parameters Parameters

$status

(string) (Optional) New status.

Default value: 'instock'


Top ↑

Source Source

File: includes/abstracts/abstract-wc-product.php

	public function set_stock_status( $status = 'instock' ) {
		$valid_statuses = wc_get_product_stock_status_options();

		if ( isset( $valid_statuses[ $status ] ) ) {
			$this->set_prop( 'stock_status', $status );
		} else {
			$this->set_prop( 'stock_status', 'instock' );
		}
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.