woocommerce_load_order_cogs_value filter-hookWC 9.5.0

Filter to customize the Cost of Goods Sold value that gets loaded for a given order.

Usage

add_filter( 'woocommerce_load_order_cogs_value', 'wp_kama_woocommerce_load_order_cogs_value_filter', 10, 2 );

/**
 * Function for `woocommerce_load_order_cogs_value` filter-hook.
 * 
 * @param float             $cogs_value The value as read from the database.
 * @param WC_Abstract_Order $product    The order for which the value is being loaded.
 *
 * @return float
 */
function wp_kama_woocommerce_load_order_cogs_value_filter( $cogs_value, $product ){

	// filter...
	return $cogs_value;
}
$cogs_value(float)
The value as read from the database.
$product(WC_Abstract_Order)
The order for which the value is being loaded.

Changelog

Since 9.5.0 Introduced.

Where the hook is called

OrdersTableDataStore::read_cogs_data()
woocommerce_load_order_cogs_value
woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php 1286
$cogs_value = apply_filters( 'woocommerce_load_order_cogs_value', $cogs_value, $order );

Where the hook is used in WooCommerce

Usage not found.