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.

Метод класса: WC_Product{}

Хуков нет.

Возвращает

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

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->adjust_cogs_value_before_set( ?float $value ): ?float;
?float $value (обязательный)
-

Код WC_Product::adjust_cogs_value_before_set() WC 9.7.1

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