Automattic\WooCommerce\Internal\Admin\Suggestions\Incentives
WooPayments::generate_context_hash
Generate a hash from the store context data.
Метод класса: WooPayments{}
Хуков нет.
Возвращает
Строку. The context hash.
Использование
// private - только в коде основоного (родительского) класса $result = $this->generate_context_hash( $context ): string;
- $context(массив) (обязательный)
- The store context data.
Код WooPayments::generate_context_hash() WooPayments::generate context hash WC 10.5.0
private function generate_context_hash( array $context ): string {
// Include only certain entries in the context hash.
// We need only discrete, user-interaction dependent data.
// Entries like `active_for` have no place in the hash generation since they change automatically.
return md5(
wp_json_encode(
array(
'country' => $context['country'] ?? '',
'locale' => $context['locale'] ?? '',
'has_orders' => $context['has_orders'] ?? false,
'has_payments' => $context['has_payments'] ?? false,
'has_wcpay' => $context['has_wcpay'] ?? false,
)
)
);
}