diff --git a/includes/class-wc-product-variable.php b/includes/class-wc-product-variable.php index bcd21bd8923..81c28f5b774 100644 --- a/includes/class-wc-product-variable.php +++ b/includes/class-wc-product-variable.php @@ -258,15 +258,15 @@ class WC_Product_Variable extends WC_Product { if ( empty( $this->prices_array[ $price_hash ] ) ) { // Get value of transient - $this->prices_array = array_filter( (array) json_decode( strval( get_transient( $transient_name ) ), true ) ); + $prices_array = array_filter( (array) json_decode( strval( get_transient( $transient_name ) ), true ) ); // If the product version has changed, reset cache - if ( empty( $this->prices_array['version'] ) || $this->prices_array['version'] !== WC_Cache_Helper::get_transient_version( 'product' ) ) { + if ( empty( $prices_array['version'] ) || $prices_array['version'] !== WC_Cache_Helper::get_transient_version( 'product' ) ) { $this->prices_array = array( 'version' => WC_Cache_Helper::get_transient_version( 'product' ) ); } // If the prices are not stored for this hash, generate them - if ( empty( $this->prices_array[ $price_hash ] ) ) { + if ( empty( $prices_array[ $price_hash ] ) ) { $prices = array(); $regular_prices = array(); $sale_prices = array(); @@ -311,19 +311,19 @@ class WC_Product_Variable extends WC_Product { asort( $regular_prices ); asort( $sale_prices ); - $this->prices_array[ $price_hash ] = array( + $prices_array[ $price_hash ] = array( 'price' => $prices, 'regular_price' => $regular_prices, 'sale_price' => $sale_prices, ); - set_transient( $transient_name, json_encode( $this->prices_array ), DAY_IN_SECONDS * 30 ); + set_transient( $transient_name, json_encode( $prices_array ), DAY_IN_SECONDS * 30 ); } /** * Give plugins one last chance to filter the variation prices array which has been generated. */ - $this->prices_array[ $price_hash ] = apply_filters( 'woocommerce_variation_prices', $this->prices_array[ $price_hash ], $this, $display ); + $this->prices_array[ $price_hash ] = apply_filters( 'woocommerce_variation_prices', $prices_array[ $price_hash ], $this, $display ); } /**