woocommerce_variation_prices

Give plugins one last chance to filter the variation prices array which has been generated and store locally to the class.

Description

apply_filters( 'woocommerce_variation_prices', (unknown) $transient_cached_prices_array_price_hash, (unknown) $product, (unknown) $include_taxes ); 

This value may differ from the transient cache. It is filtered once before storing locally.

Parameters (3)

0. $transient_cached_prices_array_price_hash (unknown)
The transient cached prices array price hash.
1. $product (unknown)
The product.
2. $include_taxes (unknown)
The include taxes.

Usage

To run the hook, copy the example below.
  1. $transient_cached_prices_array_price_hash = apply_filters( 'woocommerce_variation_prices', $transient_cached_prices_array_price_hash, $product, $include_taxes ); 
  2.  
  3. if ( !empty( $transient_cached_prices_array_price_hash ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the woocommerce_variation_prices callback 
  2. function filter_woocommerce_variation_prices( $transient_cached_prices_array_price_hash, $product, $include_taxes ) { 
  3. // make filter magic happen here... 
  4. return $transient_cached_prices_array_price_hash
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'woocommerce_variation_prices', 'filter_woocommerce_variation_prices', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'woocommerce_variation_prices', 'filter_woocommerce_variation_prices', 10, 3 ); 

Defined (1)

The filter is defined in the following location(s).

/includes/data-stores/class-wc-product-variable-data-store-cpt.php  
  1. $this->prices_array[ $price_hash ] = apply_filters( 'woocommerce_variation_prices', $transient_cached_prices_array[ $price_hash ], $product, $include_taxes );