WC_Product::set_cogs_valuepublicWC 1.0

Set the defined value of the Cost of Goods Sold for this product.

In this implementation the defined value is a monetary value, but in the future (or in derived classes) it could be something different like e.g. a percent of the price; see also get_cogs_effective_value and get_cogs_total_value.

The defined value can be null. By default this is equivalent to a value of zero, but again: in the future, or in derived classes, it can mean something different. See also adjust_cogs_value_before_set.

WARNING! If the Cost of Goods Sold feature is disabled this method will have no effect.

Method of the class: WC_Product{}

No Hooks.

Returns

null. Nothing (null).

Usage

$WC_Product = new WC_Product();
$WC_Product->set_cogs_value( ?float $value ): void;
?float $value(required)
.

WC_Product::set_cogs_value() code WC 10.3.6

public function set_cogs_value( ?float $value ): void {
	if ( $this->cogs_is_enabled( __METHOD__ ) ) {
		$value = $this->adjust_cogs_value_before_set( $value );
		$this->set_prop( 'cogs_value', $value );
	}
}