Skip to content

Commit

Permalink
Merge pull request #2550 from woocommerce/tweak/handle-no-wpcom-token…
Browse files Browse the repository at this point in the history
…-when-getting-api-pull-status

Tweak Connect Test Page errors when WPCOM token is not connected.
  • Loading branch information
jorgemd24 committed Aug 21, 2024
2 parents a9a9394 + cc5adf7 commit 315fce2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,11 @@ protected function handle_actions() {
} else {
$this->integration_status_response = json_decode( wp_remote_retrieve_body( $integration_remote_request_response ), true ) ?? [];

// If the merchant isn't connected to the Google App, it's not necessary to display an error indicating that the partner token isn't associated.
if ( ! $this->integration_status_response['is_partner_token_healthy'] && isset( $this->integration_status_response['errors'] ['rest_api_partner_token']['error_code'] ) && $this->integration_status_response['errors'] ['rest_api_partner_token']['error_code'] === 'wpcom_partner_token_not_associated' ) {
unset( $this->integration_status_response['errors'] ['rest_api_partner_token'] );
}

if ( json_last_error() || ! isset( $this->integration_status_response['site'] ) ) {
$this->response .= wp_remote_retrieve_body( $integration_remote_request_response );
}
Expand Down

0 comments on commit 315fce2

Please sign in to comment.