Skip to content

Commit

Permalink
Do not load WooCommerce if WooCommerce isn't active
Browse files Browse the repository at this point in the history
  • Loading branch information
widoz committed Oct 16, 2018
1 parent 29cb4ef commit 016a4c0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion multisite-global-media.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ function bootstrap()
$assets = new Assets($pluginProperties);
$attachment = new Attachment($site, $singleSwitcher);
$thumbnail = new Thumbnail($site, $singleSwitcher);
$wooCommerceGallery = new WooCommerce\Gallery($site, $singleSwitcher);

add_action('admin_enqueue_scripts', [$assets, 'enqueueScripts']);
add_action('admin_enqueue_scripts', [$assets, 'enqueueStyles']);
Expand All @@ -124,6 +123,12 @@ function bootstrap()
add_filter('admin_post_thumbnail_html', [$thumbnail, 'adminPostThumbnailHtml'], 99, 3);
add_filter('post_thumbnail_html', [$thumbnail, 'postThumbnailHtml'], 99, 5);

if (!function_exists('wc')) {
return;
}

$wooCommerceGallery = new WooCommerce\Gallery($site, $singleSwitcher);

add_action('woocommerce_new_product', [$wooCommerceGallery, 'saveGalleryIds']);
add_action('woocommerce_update_product', [$wooCommerceGallery, 'saveGalleryIds']);
add_action('add_meta_boxes', [$wooCommerceGallery, 'overrideMetaboxCallback'], PHP_INT_MAX);
Expand Down

0 comments on commit 016a4c0

Please sign in to comment.