WC_Product_Variation::get_parent_cogs_effective_value()publicWC 1.0

Get the Cost of Goods Sold effective value of the parent product.

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

Хуков нет.

Возвращает

float. Cost of Goods Sold effective value of the parent product.

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

$WC_Product_Variation = new WC_Product_Variation();
$WC_Product_Variation->get_parent_cogs_effective_value(): float;

Код WC_Product_Variation::get_parent_cogs_effective_value() WC 9.8.2

public function get_parent_cogs_effective_value(): float {
	$parent_cogs = $this->parent_data['cogs_effective_value'] ?? null;
	if ( is_null( $parent_cogs ) ) {
		$parent_product                            = wc_get_product( $this->get_parent_id() );
		$parent_cogs                               = $parent_product ? $parent_product->get_cogs_effective_value() : 0;
		$this->parent_data['cogs_effective_value'] = $parent_cogs;
	}
	return $parent_cogs;
}