woocommerce_calculated_order_item_cogs_value
Filter to modify the Cost of Goods Sold value that gets calculated for a given order item.
Использование
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.
Список изменений
С версии 9.5.0 | Введена. |
Где вызывается хук
woocommerce_calculated_order_item_cogs_value
woocommerce/includes/class-wc-order-item.php 487
$value = apply_filters( 'woocommerce_calculated_order_item_cogs_value', $value, $this );