WC_Product_Variation::get_cogs_total_value_coreprotectedWC 1.0

Get the effective total value of the Cost of Goods Sold for this product. (the monetary value that will be applied to orders and used for analytics purposes).

If "additive" flag is set, the total value is equal to sum of the effective values of the variation and the parent product. Otherwise, if the defined value for this variation is null, the effective value is equal to the effective value of the parent product. Otherwise, the effective value is equal to the effective value of the variation.

Method of the class: WC_Product_Variation{}

No Hooks.

Returns

float.

Usage

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

WC_Product_Variation::get_cogs_total_value_core() code WC 10.3.6

protected function get_cogs_total_value_core(): float {
	if ( $this->get_cogs_value_is_additive() ) {
		return $this->get_parent_cogs_effective_value() + $this->get_cogs_effective_value();
	} else {
		return is_null( $this->get_cogs_value() ) ? $this->get_parent_cogs_effective_value() : $this->get_cogs_effective_value();
	}
}