Automattic\WooCommerce\Internal\AddressProvider

AbstractAutomatticAddressProvider::set_jwt │ public │ WC 1.0

Sets the JWT for the address service.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$AbstractAutomatticAddressProvider = new AbstractAutomatticAddressProvider();
$AbstractAutomatticAddressProvider->set_jwt( $jwt );
$jwt(строка) (обязательный)
The JWT for the address service.

Код AbstractAutomatticAddressProvider::set_jwt() WC 11.2.2

public function set_jwt( $jwt ) {
	$this->jwt = $jwt;
	if ( null !== $jwt ) {
		$cache_duration = $this->get_jwt_cache_duration( $jwt );
		// If the token is expired, we don't cache it and we fetch a new one.
		if ( 0 === $cache_duration ) {
			$this->jwt = null;
			$this->load_jwt();
			return;
		}
		$this->update_cached_option( 'address_autocomplete_jwt', $jwt, $cache_duration );
	} else {
		$this->delete_cached_option( 'address_autocomplete_jwt' );
	}
}