Work around possible wc-admin fatal error

This commit is contained in:
Jorge A. Torres 2021-08-09 19:16:44 -07:00
parent 095acaee4e
commit ab27d10383
2 changed files with 6 additions and 2 deletions

View file

@ -34,7 +34,11 @@ class DeactivateNote {
return;
}
self::possibly_add_note();
try {
self::possibly_add_note();
} catch ( \Exception $e ) {
return;
}
}
/**

View file

@ -68,7 +68,7 @@ class CompatModule implements ModuleInterface {
add_action(
'woocommerce_init',
function() {
if ( is_callable( array( WC(), 'is_wc_admin_active' ) ) && WC()->is_wc_admin_active() ) {
if ( is_callable( array( WC(), 'is_wc_admin_active' ) ) && WC()->is_wc_admin_active() && class_exists( 'Automattic\WooCommerce\Admin\Notes\Notes' ) ) {
PPEC\DeactivateNote::init();
}
}