Skip to content

Commit

Permalink
Redirect to WC home page after successful WCPay KYC (#1759)
Browse files Browse the repository at this point in the history
* Redirect to WC home page after successful WCPay KYC

* changelog
  • Loading branch information
becdetat authored May 17, 2021
1 parent 7decc3a commit 42403a3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* Update - Implement expirement on Connect Page.
* Fix - Columns are misaligned on Payments->Transactions/Disputes page.
* Fix - Risk level is displayed as a "Numeric" value in transactions CSV.
* Add - Redirect to WooCommerce home page after successful WooCommerce Payments KYC

= 2.3.3 - 2021-05-06 =
* Update - Additional logic and styling for instant deposits.
Expand Down
17 changes: 15 additions & 2 deletions includes/class-wc-payments-account.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,18 @@ private function redirect_to_onboarding_page( $error_message = null ) {
exit();
}

/**
* Immediately redirect to the WooCommerce Admin home page.
*/
private function redirect_to_wc_admin_home() {
$params = [
'page' => 'wc-admin',
];

wp_safe_redirect( admin_url( add_query_arg( $params, 'admin.php' ) ) );
exit();
}

/**
* Checks if Stripe account is connected and redirects to the onboarding page if it is not.
*
Expand Down Expand Up @@ -329,12 +341,13 @@ public function maybe_handle_oauth() {

if ( isset( $_GET['wcpay-connection-success'] ) ) {
$account_status = $this->get_account_status_data();

if ( empty( $account_status['error'] ) && $account_status['paymentsEnabled'] ) {
$message = __( 'Thanks for verifying your business details. You\'re ready to start taking payments!', 'woocommerce-payments' );
$this->redirect_to_wc_admin_home();
} else {
$message = __( 'Thanks for verifying your business details!', 'woocommerce-payments' );
$this->add_notice_to_settings_page( $message, 'notice-success' );
}
$this->add_notice_to_settings_page( $message, 'notice-success' );
return;
}

Expand Down

0 comments on commit 42403a3

Please sign in to comment.