Only use the 'function' portion when generating price hashes

Keeps hashes the same after page load when a plugin uses a class method
callback or anonymous function Closes #9922 @claudiosmweb
This commit is contained in:
Mike Jolley 2015-12-31 16:21:12 +00:00
parent 429fee1703
commit 7c7e21be50
1 changed files with 6 additions and 4 deletions

View File

@ -244,9 +244,7 @@ class WC_Product_Variable extends WC_Product {
* @var string * @var string
*/ */
if ( $display ) { if ( $display ) {
$tax_rate_ids = array_keys( WC_Tax::get_rates() ); $price_hash = array( get_option( 'woocommerce_tax_display_shop', 'excl' ), WC_Tax::get_rates() );
asort( $tax_rate_ids );
$price_hash = array( get_option( 'woocommerce_tax_display_shop', 'excl' ), $tax_rate_ids );
} else { } else {
$price_hash = array( false ); $price_hash = array( false );
} }
@ -255,7 +253,11 @@ class WC_Product_Variable extends WC_Product {
foreach ( $filter_names as $filter_name ) { foreach ( $filter_names as $filter_name ) {
if ( ! empty( $wp_filter[ $filter_name ] ) ) { if ( ! empty( $wp_filter[ $filter_name ] ) ) {
$price_hash[ $filter_name ] = $wp_filter[ $filter_name ]; $price_hash[ $filter_name ] = array();
foreach ( $wp_filter[ $filter_name ] as $priority => $callbacks ) {
$price_hash[ $filter_name ][] = array_values( wp_list_pluck( $callbacks, 'function' ) );
}
} }
} }