woocommerce_load_product_cogs_value filter-hookWC 9.5.0

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

Usage

add_filter( 'woocommerce_load_product_cogs_value', 'wp_kama_woocommerce_load_product_cogs_value_filter', 10, 2 );

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

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

Changelog

Since 9.5.0 Introduced.

Where the hook is called

WC_Product_Data_Store_CPT::load_cogs_data()
woocommerce_load_product_cogs_value
woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php 502
$cogs_value = apply_filters( 'woocommerce_load_product_cogs_value', $cogs_value, $product );

Where the hook is used in WooCommerce

Usage not found.