diff --git a/modules/ppcp-button/src/Assets/class-smartbutton.php b/modules/ppcp-button/src/Assets/class-smartbutton.php index 9e6ca8e99..017a7acfd 100644 --- a/modules/ppcp-button/src/Assets/class-smartbutton.php +++ b/modules/ppcp-button/src/Assets/class-smartbutton.php @@ -828,18 +828,23 @@ private function context(): string { * @throws \WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException If a setting has not been found. */ private function dcc_is_enabled(): bool { + if ( ! is_checkout() ) { + return false; + } if ( ! $this->dcc_applies->for_country_currency() ) { return false; } $keys = array( - 'dcc_enabled' => 'is_checkout', + 'client_id', + 'client_secret', + 'dcc_enabled', ); - foreach ( $keys as $key => $callback ) { - if ( $this->settings->has( $key ) && $this->settings->get( $key ) && $callback() ) { - return true; + foreach ( $keys as $key ) { + if ( ! $this->settings->has( $key ) || ! $this->settings->get( $key ) ) { + return false; } } - return false; + return true; } /**