woocommerce_get_product_cogs_total_value
Filter to customize the total Cost of Goods Sold value that get_cogs_total_value returns for a given product.
Usage
add_filter( 'woocommerce_get_product_cogs_total_value', 'wp_kama_woocommerce_get_product_cogs_total_value_filter', 10, 2 ); /** * Function for `woocommerce_get_product_cogs_total_value` filter-hook. * * @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 float */ function wp_kama_woocommerce_get_product_cogs_total_value_filter( $total_value, $product ){ // filter... return $total_value; }
- $total_value(float)
- The effective total value of the product.
- $product(WC_Product)
- The product for which the total value is being retrieved.
Changelog
Since 9.5.0 | Introduced. |
Where the hook is called
woocommerce_get_product_cogs_total_value
woocommerce/includes/abstracts/abstract-wc-product.php 2275
return apply_filters( 'woocommerce_get_product_cogs_total_value', $this->get_cogs_total_value_core(), $this );