WordPress at Your Fingertips
function is not described

WC_Product::set_stock_status() public WC 1.0

Set stock status.

{} It's a method of the class: WC_Product{}

No Hooks.

Return

null. Nothing.

Usage

$WC_Product = new WC_Product();
$WC_Product->set_stock_status( $status );
$status(string)
New status.

Code of WC_Product::set_stock_status() WC 5.5.2

<?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' );
	}
}