Automattic\WooCommerce\Internal\Utilities
PluginInstaller::woocommerce_is_active_in_current_site()
Check if WooCommerce is installed and active in the current blog. This is useful for multisite installs when a blog other than the one running this code is selected with 'switch_to_blog'.
Метод класса: PluginInstaller{}
Хуков нет.
Возвращает
true|false
. True if WooCommerce is installed and active in the current blog, false otherwise.
Использование
$result = PluginInstaller::woocommerce_is_active_in_current_site(): bool;
Код PluginInstaller::woocommerce_is_active_in_current_site() PluginInstaller::woocommerce is active in current site WC 9.7.1
private static function woocommerce_is_active_in_current_site(): bool { $active_valid_plugins = wc_get_container()->get( PluginUtil::class )->get_all_active_valid_plugins(); return ! empty( array_filter( $active_valid_plugins, fn( $plugin ) => substr_compare( $plugin, '/woocommerce.php', -strlen( '/woocommerce.php' ) ) === 0 ) ); }