woocommerce_order_item_cogs_per_item_tooltip
Filter to customize the text of the "Cost per unit" tooltip for the "Cost" (of Goods Sold) column in the order details page. If an empty string is returned then the tooltip won't be rendered.
Usage
add_filter( 'woocommerce_order_item_cogs_per_item_tooltip', 'wp_kama_woocommerce_order_item_cogs_per_tooltip_filter', 10, 4 ); /** * Function for `woocommerce_order_item_cogs_per_item_tooltip` filter-hook. * * @param string $tooltip_text Original tooltip text, may be an empty string. * @param float $cost_per_item The numerical value of the unit Cost of Goods Sold of the product. * @param string $formatted_cost_per_item The unit Cost of Goods Sold of the product already formatted for display. * @param WC_Order_Item $order_item The order item this filter is being fired for. * * @return string */ function wp_kama_woocommerce_order_item_cogs_per_tooltip_filter( $tooltip_text, $cost_per_item, $formatted_cost_per_item, $order_item ){ // filter... return $tooltip_text; }
- $tooltip_text(string)
- Original tooltip text, may be an empty string.
- $cost_per_item(float)
- The numerical value of the unit Cost of Goods Sold of the product.
- $formatted_cost_per_item(string)
- The unit Cost of Goods Sold of the product already formatted for display.
- $order_item(WC_Order_Item)
- The order item this filter is being fired for.
Changelog
Since 9.9.0 | Introduced. |
Where the hook is called
woocommerce_order_item_cogs_per_item_tooltip
woocommerce/includes/class-wc-order-item.php 632
return apply_filters( 'woocommerce_order_item_cogs_per_item_tooltip', $tooltip_text, $cost_per_item, $formatted_cost_per_item, $this );