woocommerce_calculated_order_item_cogs_value filter-hookWC 9.5.0

Filter to modify the Cost of Goods Sold value that gets calculated for a given order item.

Usage

add_filter( 'woocommerce_calculated_order_item_cogs_value', 'wp_kama_woocommerce_calculated_order_item_cogs_value_filter', 10, 2 );

/**
 * Function for `woocommerce_calculated_order_item_cogs_value` filter-hook.
 * 
 * @param float|null    $value     The value originally calculated, null if it was not possible to calculate it.
 * @param WC_Order_Item $line_item The order item for which the value is calculated.
 *
 * @return float|null
 */
function wp_kama_woocommerce_calculated_order_item_cogs_value_filter( $value, $line_item ){

	// filter...
	return $value;
}
$value(float|null)
The value originally calculated, null if it was not possible to calculate it.
$line_item(WC_Order_Item)
The order item for which the value is calculated.

Changelog

Since 9.5.0 Introduced.

Where the hook is called

WC_Order_Item::calculate_cogs_value()
woocommerce_calculated_order_item_cogs_value
woocommerce/includes/class-wc-order-item.php 488
$value = apply_filters( 'woocommerce_calculated_order_item_cogs_value', $value, $this );

Where the hook is used in WooCommerce

Usage not found.