From aae802f31993598103f81fb837bede17a1776a99 Mon Sep 17 00:00:00 2001 From: Akeda Bagus Date: Sat, 17 Aug 2019 00:36:28 +0700 Subject: [PATCH] Add support to allow in-app purchase installation after connected. --- includes/admin/class-wc-admin-addons.php | 7 ++++--- includes/admin/helper/class-wc-helper.php | 7 +++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/includes/admin/class-wc-admin-addons.php b/includes/admin/class-wc-admin-addons.php index 527de16b128..34472ce6e24 100644 --- a/includes/admin/class-wc-admin-addons.php +++ b/includes/admin/class-wc-admin-addons.php @@ -487,9 +487,10 @@ class WC_Admin_Addons { // so WCCOM "back" link returns user to where they were. $back_admin_path = add_query_arg( array() ); return array( - 'wccom-site' => site_url(), - 'wccom-back' => esc_url( $back_admin_path ), - 'wccom-woo-version' => WC_VERSION, + 'wccom-site' => site_url(), + 'wccom-back' => esc_url( $back_admin_path ), + 'wccom-woo-version' => WC_VERSION, + 'wccom-helper-nonce' => wp_create_nonce( 'connect' ), ); } diff --git a/includes/admin/helper/class-wc-helper.php b/includes/admin/helper/class-wc-helper.php index 7143ed9295e..e04fb1de839 100644 --- a/includes/admin/helper/class-wc-helper.php +++ b/includes/admin/helper/class-wc-helper.php @@ -799,6 +799,13 @@ class WC_Helper { WC_Tracker::send_tracking_data( true ); } + // If connecting through in-app purchase, redirects back to WooCommerce.com + // for product installation. + if ( ! empty( $_GET['wccom-install-url'] ) ) { + wp_redirect( wp_unslash( $_GET['wccom-install-url'] ) ); + exit; + } + wp_safe_redirect( add_query_arg( array(