Fix an issue with OBW when wc-pay and Jetpack are both being installed (https://github.com/woocommerce/woocommerce-admin/pull/6957)
* Fix an issue with OBW when wc-pay and Jetpack are both being installed * Add readme and testing instructions for woocommerce/woocommerce-admin#6957 * Add filters for the installed and activated plugins and tie into those filters for ensuring Jetpack is installed ahead of WCPay
This commit is contained in:
parent
094b73561d
commit
90d2bdcb1f
|
@ -140,6 +140,12 @@ In case the report shows "no data", please reimport historical data by following
|
|||
- Click on the 3 dots of the card, click `Hide this`, it should make the card disappear, it should also not show on refresh.
|
||||
This can't be shown again unless the `woocommerce_show_marketplace_suggestions` option is deleted (through PHPMyAdmin or using `wp option delete woocommerce_show_marketplace_suggestions`).
|
||||
|
||||
### Fix an issue with OBW when wc-pay and Jetpack are both being installed. #6957
|
||||
|
||||
- Complete the OBW until you get to the business details step.
|
||||
- Deselect "Add recommended business features to my site", and select only Jetpack and WooCommerce Payments for installation.
|
||||
- The plugins should be installed and activated correctly, and you should be able to continue in the flow.
|
||||
|
||||
## 2.2.0
|
||||
|
||||
### Fixed event tracking for merchant email notes #6616
|
||||
|
|
|
@ -138,6 +138,7 @@ Release and roadmap notes are available on the [WooCommerce Developers Blog](htt
|
|||
- Update: Task list component with new Experimental Task list. #6849
|
||||
- Update: Redirect to WC Home after setting up a payment method #6891
|
||||
- Dev: Fix a bug where trying to load an asset registry causes a crash. #6951
|
||||
- Fix: Address an issue with OBW when installing only WooCommerce payments and Jetpack. #6957
|
||||
|
||||
== 2.2.0 3/30/2021 ==
|
||||
|
||||
|
|
|
@ -220,6 +220,13 @@ class Plugins extends \WC_REST_Data_Controller {
|
|||
public function install_plugins( $request ) {
|
||||
$plugins = explode( ',', $request['plugins'] );
|
||||
|
||||
/**
|
||||
* Filter the list of plugins to install.
|
||||
*
|
||||
* @param array $plugins A list of the plugins to install.
|
||||
*/
|
||||
$plugins = apply_filters( 'woocommerce_admin_plugins_pre_install', $plugins );
|
||||
|
||||
if ( empty( $request['plugins'] ) || ! is_array( $plugins ) ) {
|
||||
return new \WP_Error( 'woocommerce_rest_invalid_plugins', __( 'Plugins must be a non-empty array.', 'woocommerce-admin' ), 404 );
|
||||
}
|
||||
|
@ -373,6 +380,13 @@ class Plugins extends \WC_REST_Data_Controller {
|
|||
// the mollie-payments-for-woocommerce plugin calls `WP_Filesystem()` during it's activation hook, which crashes without this include.
|
||||
require_once ABSPATH . 'wp-admin/includes/file.php';
|
||||
|
||||
/**
|
||||
* Filter the list of plugins to activate.
|
||||
*
|
||||
* @param array $plugins A list of the plugins to activate.
|
||||
*/
|
||||
$plugins = apply_filters( 'woocommerce_admin_plugins_pre_activate', $plugins );
|
||||
|
||||
foreach ( $plugins as $plugin ) {
|
||||
$slug = $plugin;
|
||||
$path = isset( $plugin_paths[ $slug ] ) ? $plugin_paths[ $slug ] : false;
|
||||
|
|
|
@ -91,6 +91,8 @@ class Onboarding {
|
|||
10,
|
||||
2
|
||||
);
|
||||
add_action( 'woocommerce_admin_plugins_pre_activate', array( $this, 'activate_and_install_jetpack_ahead_of_wcpay' ) );
|
||||
add_action( 'woocommerce_admin_plugins_pre_install', array( $this, 'activate_and_install_jetpack_ahead_of_wcpay' ) );
|
||||
|
||||
// Always hook into Jetpack connection even if outside of admin.
|
||||
add_action( 'jetpack_site_registered', array( $this, 'set_woocommerce_setup_jetpack_opted_in' ) );
|
||||
|
@ -1070,4 +1072,23 @@ class Onboarding {
|
|||
update_option( 'woocommerce_task_list_hidden', 'yes' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that Jetpack gets installed and activated ahead of WooCommerce Payments
|
||||
* if both are being installed/activated at the same time.
|
||||
*
|
||||
* See: https://github.com/Automattic/woocommerce-payments/issues/1663
|
||||
* See: https://github.com/Automattic/jetpack/issues/19624
|
||||
*
|
||||
* @param array $plugins A list of plugins to install or activate.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function activate_and_install_jetpack_ahead_of_wcpay( $plugins ) {
|
||||
if ( in_array( 'jetpack', $plugins, true ) && in_array( 'woocommerce-payments', $plugins, true ) ) {
|
||||
array_unshift( $plugins, 'jetpack' );
|
||||
$plugins = array_unique( $plugins );
|
||||
}
|
||||
return $plugins;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue