diff --git a/includes/class-woocommerce.php b/includes/class-woocommerce.php index 1fe2dd3b2c7..276b6c89409 100644 --- a/includes/class-woocommerce.php +++ b/includes/class-woocommerce.php @@ -801,6 +801,10 @@ final class WooCommerce { public function activated_plugin( $filename ) { include_once dirname( __FILE__ ) . '/admin/helper/class-wc-helper.php'; + if ( 'woocommerce/woocommerce.php' === $filename ) { + set_transient( 'woocommerce_activated_plugin', true ); + } + WC_Helper::activated_plugin( $filename ); } diff --git a/src/Packages.php b/src/Packages.php index d3332e9fa75..71e634d8491 100644 --- a/src/Packages.php +++ b/src/Packages.php @@ -68,6 +68,16 @@ class Packages { } call_user_func( array( $package_class, 'init' ) ); } + + // Proxies "activated_plugin" hook for embedded packages listen on WC plugin activation + // https://github.com/woocommerce/woocommerce/issues/28697 + if ( is_admin() ) { + $is_woocommerce_just_activated = get_transient( 'woocommerce_activated_plugin' ); + if ( $is_woocommerce_just_activated ) { + do_action( 'woocommerce_activated_plugin' ); + delete_transient( 'woocommerce_activated_plugin' ); + } + } } /**