woocommerce_load_order_item_cogs_value
Filter to customize the Cost of Goods Sold value that gets loaded for a given order item.
Usage
add_filter( 'woocommerce_load_order_item_cogs_value', 'wp_kama_woocommerce_load_order_item_cogs_value_filter', 10, 2 ); /** * Function for `woocommerce_load_order_item_cogs_value` filter-hook. * * @param float $cogs_value The value as read from the database. * @param WC_Order_Item $product The order item for which the value is being loaded. * * @return float */ function wp_kama_woocommerce_load_order_item_cogs_value_filter( $cogs_value, $product ){ // filter... return $cogs_value; }
- $cogs_value(float)
- The value as read from the database.
- $product(WC_Order_Item)
- The order item for which the value is being loaded.
Changelog
Since 9.5.0 | Introduced. |
Where the hook is called
woocommerce_load_order_item_cogs_value
woocommerce/includes/data-stores/abstract-wc-order-item-type-data-store.php 192
$cogs_value = apply_filters( 'woocommerce_load_order_item_cogs_value', $cogs_value, $item );