WC_Product_Variation::get_cogs_effective_value_core()protectedWC 1.0

Get the effective value of the Cost of Goods Sold for this product. (the final, actual monetary value).

See get_cogs_value_overrides_parent.

Method of the class: WC_Product_Variation{}

No Hooks.

Return

float.

Usage

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

WC_Product_Variation::get_cogs_effective_value_core() code WC 9.5.1

protected function get_cogs_effective_value_core(): float {
	if ( $this->get_cogs_value_overrides_parent() ) {
		return parent::get_cogs_value();
	}

	$parent_value = (float) get_post_meta( $this->get_parent_id(), '_cogs_total_value', true );
	return parent::get_cogs_value() + $parent_value;
}