WC_Product::set_cogs_value
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.
Метод класса: WC_Product{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$WC_Product = new WC_Product(); $WC_Product->set_cogs_value( ?float $value ): void;
- ?float $value(обязательный)
- .
Код WC_Product::set_cogs_value() WC Product::set cogs value WC 10.4.3
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 );
}
}