WordPress at a glance
function is not described

WC_Product_Variable_Data_Store_CPT::get_price_hash() protected WC 3.0.0

Create unique cache key based on the tax location (affects displayed/cached prices), product version and active price filters. DEVELOPERS should filter this hash if offering conditional pricing to keep it unique.

{} It's a method of the class: WC_Product_Variable_Data_Store_CPT{}

Return

String. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_price_hash( $product, $for_display );
$product(WC_Product) (required)
Product object.
$for_display(true|false)
If taxes should be calculated or not.

Changelog

Since 3.0.0 Introduced.

Code of WC_Product_Variable_Data_Store_CPT::get_price_hash() WC 5.3.0

<?php
protected function get_price_hash( &$product, $for_display = false ) {
	global $wp_filter;

	$price_hash   = $for_display && wc_tax_enabled() ? array( get_option( 'woocommerce_tax_display_shop', 'excl' ), WC_Tax::get_rates() ) : array( false );
	$filter_names = array( 'woocommerce_variation_prices_price', 'woocommerce_variation_prices_regular_price', 'woocommerce_variation_prices_sale_price' );

	foreach ( $filter_names as $filter_name ) {
		if ( ! empty( $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' ) );
			}
		}
	}

	return md5( wp_json_encode( apply_filters( 'woocommerce_get_variation_prices_hash', $price_hash, $product, $for_display ) ) );
}