This commit is contained in:
Emili Castells Guasch 2024-08-07 12:47:11 +02:00
parent 7778cfafed
commit 939991c42f
2 changed files with 4 additions and 4 deletions

View file

@ -80,6 +80,10 @@ class SdkClientToken {
* @throws RuntimeException If something unexpected happens.
*/
public function sdk_client_token(): string {
if ( $this->cache->has( self::CACHE_KEY ) ) {
return $this->cache->get( self::CACHE_KEY );
}
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
$domain = wp_unslash( $_SERVER['HTTP_HOST'] ?? '' );
$domain = preg_replace( '/^www\./', '', $domain );

View file

@ -84,10 +84,6 @@ class SavePaymentMethodsModule implements ModuleInterface {
add_filter(
'woocommerce_paypal_payments_localized_script_data',
function( array $localized_script_data ) use ( $c ) {
if ( ! is_user_logged_in() ) {
return $localized_script_data;
}
$api = $c->get( 'api.user-id-token' );
assert( $api instanceof UserIdToken );