WC_Cache_Helper::geolocation_ajax_get_location_hashpublic staticWC 1.0

Get a hash of the customer location.

Метод класса: WC_Cache_Helper{}

Возвращает

Строку.

Использование

$result = WC_Cache_Helper::geolocation_ajax_get_location_hash();

Код WC_Cache_Helper::geolocation_ajax_get_location_hash() WC 9.9.3

public static function geolocation_ajax_get_location_hash() {
	$customer             = new WC_Customer( 0, true );
	$location             = array();
	$location['country']  = $customer->get_billing_country();
	$location['state']    = $customer->get_billing_state();
	$location['postcode'] = $customer->get_billing_postcode();
	$location['city']     = $customer->get_billing_city();
	$location_hash        = substr( md5( strtolower( implode( '', $location ) ) ), 0, 12 );

	/**
	 * Controls the location hash used in geolocation-based caching.
	 *
	 * @since 3.6.0
	 *
	 * @param string      $location_hash The hash used for geolocation.
	 * @param array       $location      The location/address data.
	 * @param WC_Customer $customer      The current customer object.
	 */
	return apply_filters( 'woocommerce_geolocation_ajax_get_location_hash', $location_hash, $location, $customer );
}