Add logic to skip WC Payment plugin note if not part of the onboarding business extension list (https://github.com/woocommerce/woocommerce-admin/pull/5619)

This commit is contained in:
louwie17 2020-11-13 15:56:39 -04:00 committed by GitHub
parent fde504f9d6
commit 43e7a5e5ca
1 changed files with 13 additions and 3 deletions

View File

@ -45,11 +45,21 @@ class SetUpAdditionalPaymentTypes {
}
/**
* Executes when the WooCommerce Payments plugin is activated. Possibly
* adds the note if it isn't already in the database and if it matches any
* criteria (see get_note()).
* Executes when the WooCommerce Payments plugin is activated. It does nothing
* if WooCommerce Payments plugin is not included in onboarding business extensions,
* otherwise it possibly adds the note if it isn't already in the database and if
* it matches any criteria (see get_note()).
*/
public static function on_activate_wcpay() {
$onboarding_profile = get_option( 'woocommerce_onboarding_profile', array() );
if ( is_array( $onboarding_profile ) && array_key_exists( 'business_extensions', $onboarding_profile ) ) {
if ( ! is_array( $onboarding_profile['business_extensions'] ) ||
! in_array( 'woocommerce-payments', $onboarding_profile['business_extensions'], true )
) {
return;
}
}
self::possibly_add_note();
}