woocommerce_get_variation_prices_hash
Filters the hash used for caching variation prices.
IMPORTANT: see the documentation for the woocommerce_variation_prices_price
Usage
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)
- 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.
Changelog
| Since 2.5.0 | Introduced. |
Where the hook is called
woocommerce_get_variation_prices_hash
woocommerce/includes/data-stores/class-wc-product-variable-data-store-cpt.php 653
$price_hash = apply_filters( 'woocommerce_get_variation_prices_hash', $price_hash, $product, $for_display );