WC_Product::get_cogs_total_value()publicWC 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).

WARNING! If the Cost of Goods Sold feature is disabled this method will always return zero.

Method of the class: WC_Product{}

Return

float. The effective total value for this product.

Usage

$WC_Product = new WC_Product();
$WC_Product->get_cogs_total_value(): float;

WC_Product::get_cogs_total_value() code WC 9.5.1

public function get_cogs_total_value(): float {
	if ( ! $this->cogs_is_enabled( __METHOD__ ) ) {
		return 0;
	}

	/**
	 * Filter to customize the total Cost of Goods Sold value that get_cogs_total_value returns for a given product.
	 *
	 * @since 9.5.0
	 *
	 * @param float $total_value The effective total value of the product.
	 * @param WC_Product $product The product for which the total value is being retrieved.
	 */
	return apply_filters( 'woocommerce_get_product_cogs_total_value', $this->get_cogs_total_value_core(), $this );
}