WC_Product::adjust_cogs_value_before_set()protectedWC 1.0

Adjust the value of the Cost of Goods Sold before actually setting it.

To disable the conversion of zero into null in a derived class, override this method with just "return $value;" in the body.

Method of the class: WC_Product{}

No Hooks.

Return

float|null. The actual value that will be set for the cost property.

Usage

// protected - for code of main (parent) or child class
$result = $this->adjust_cogs_value_before_set( ?float $value ): ?float;
?float $value (required)
-

WC_Product::adjust_cogs_value_before_set() code WC 9.7.1

protected function adjust_cogs_value_before_set( ?float $value ): ?float {
	return 0.0 === $value ? null : $value;
}