woocommerce_get_variation_prices_hash
Filters the hash used for caching variation prices.
IMPORTANT: see the documentation for the woocommerce_variation_prices_price
Использование
add_filter( 'woocommerce_get_variation_prices_hash', 'wp_kama_woocommerce_get_variation_prices_hash_filter', 10, 3 );
/**
* Function for `woocommerce_get_variation_prices_hash` filter-hook.
*
* @param array $price_hash Array of factors used to generate the cache key hash.
* @param WC_Product $product The variable product object.
* @param bool $for_display Whether prices are for display (with tax adjustments) or calculations.
*
* @return array
*/
function wp_kama_woocommerce_get_variation_prices_hash_filter( $price_hash, $product, $for_display ){
// filter...
return $price_hash;
}
- $price_hash(массив)
- Array of factors used to generate the cache key hash.
- $product(WC_Product)
- The variable product object.
- $for_display(true|false)
- Whether prices are for display (with tax adjustments) or calculations.
Список изменений
| С версии 2.5.0 | Введена. |
Где вызывается хук
woocommerce_get_variation_prices_hash
woocommerce/includes/data-stores/class-wc-product-variable-data-store-cpt.php 630
$price_hash = apply_filters( 'woocommerce_get_variation_prices_hash', $price_hash, $product, $for_display );