WC_Product::adjust_cogs_value_before_setprotectedWC 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.

Returns

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 10.6.2

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