woocommerce_load_product_cogs_is_additive_flag хук-фильтрWC 9.7.0

Filter to customize the "Cost of Goods Sold value is additive" flag that gets loaded for a given variable product.

Использование

add_filter( 'woocommerce_load_product_cogs_is_additive_flag', 'wp_kama_woocommerce_load_product_cogs_is_additive_flag_filter', 10, 2 );

/**
 * Function for `woocommerce_load_product_cogs_is_additive_flag` filter-hook.
 * 
 * @param bool       $cogs_value_is_additive The flag as read from the database.
 * @param WC_Product $product                The product for which the flag is being loaded.
 *
 * @return bool
 */
function wp_kama_woocommerce_load_product_cogs_is_additive_flag_filter( $cogs_value_is_additive, $product ){

	// filter...
	return $cogs_value_is_additive;
}
$cogs_value_is_additive(true|false)
The flag as read from the database.
$product(WC_Product)
The product for which the flag is being loaded.

Список изменений

С версии 9.7.0 Введена.

Где вызывается хук

WC_Product_Variation_Data_Store_CPT::load_cogs_data()
woocommerce_load_product_cogs_is_additive_flag
woocommerce/includes/data-stores/class-wc-product-variation-data-store-cpt.php 468
$cogs_value_is_additive = apply_filters( 'woocommerce_load_product_cogs_is_additive_flag', $cogs_value_is_additive, $product );

Где используется хук в WooCommerce

Использование не найдено.