woocommerce_product_get_cogs_html
Filter to customize how the Cost of Goods Sold value for a product gets rendered to HTML.
Usage
add_filter( 'woocommerce_product_get_cogs_html', 'wp_kama_woocommerce_product_get_cogs_html_filter', 10, 3 );
/**
* Function for `woocommerce_product_get_cogs_html` filter-hook.
*
* @param string $html The rendered HTML.
* @param float $value The cost value that is being rendered.
* @param WC_Product $product The product for which the cost is rendered.
*
* @return string
*/
function wp_kama_woocommerce_product_get_cogs_html_filter( $html, $value, $product ){
// filter...
return $html;
}
- $html(string)
- The rendered HTML.
- $value(float)
- The cost value that is being rendered.
- $product(WC_Product)
- The product for which the cost is rendered.
Changelog
| Since 9.8.0 | Introduced. |
Where the hook is called
woocommerce_product_get_cogs_html
woocommerce/includes/abstracts/abstract-wc-product.php 2065
return apply_filters( 'woocommerce_product_get_cogs_html', $html, $value, $this );