Skip to content

Commit

Permalink
Fix plugin crash when woocommerce is not activated/installed. Addwp a…
Browse files Browse the repository at this point in the history
…dmin notice
  • Loading branch information
devsbequest committed Nov 28, 2023
1 parent 4c07802 commit e541ae8
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions wookey_woocommerce_webauth_gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,23 @@
function run_proton_wc_gateway()
{

$plugin = new ProtonWcGateway();
$plugin->run();
if ( class_exists( 'WooCommerce' ) ) {
$plugin = new ProtonWcGateway();
$plugin->run();
}else {
add_action( 'admin_notices', 'sample_admin_notice_success' );
}
}

function sample_admin_notice_success() {
?>
<div class="notice notice-error">
<p><b><?php _e( 'Wookey - Webauth Gateway for Woocommerce require WooCommerce to work!', 'sample-text-domain' ); ?></b></p>
<a href="/wp-admin/plugin-install.php?s=woo&tab=search&type=term">Install Woocommerce </a>
<p></p>
</div>
<?php
}


run_proton_wc_gateway();

0 comments on commit e541ae8

Please sign in to comment.