woocommerce_get_product_cogs_total_value хук-фильтрWC 9.5.0

Filter to customize the total Cost of Goods Sold value that get_cogs_total_value returns for a given product.

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

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.

Список изменений

С версии 9.5.0 Введена.

Где вызывается хук

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

Где используется хук в WooCommerce

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