Automattic\WooCommerce\Internal\AddressProvider
AbstractAutomatticAddressProvider::set_jwt
Sets the JWT for the address service.
Method of the class: AbstractAutomatticAddressProvider{}
No Hooks.
Returns
null. Nothing (null).
Usage
$AbstractAutomatticAddressProvider = new AbstractAutomatticAddressProvider(); $AbstractAutomatticAddressProvider->set_jwt( $jwt );
- $jwt(string) (required)
- The JWT for the address service.
AbstractAutomatticAddressProvider::set_jwt() AbstractAutomatticAddressProvider::set jwt code WC 10.3.3
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' );
}
}