Skip to content

Commit

Permalink
πŸ› Handle if gateway is not activated
Browse files Browse the repository at this point in the history
  • Loading branch information
larasmorningtrain committed Mar 14, 2024
1 parent 1b9e690 commit cdd5c41
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/WoocommerceEconomic.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,19 @@ public static function init(): void

public static function registerGateway($gateways): array
{
if (! class_exists('WC_Payment_Gateway')) {
return $gateways;
}
$gateways[] = \WC_Gateway_Economic_Invoice::class;

return $gateways;
}

public static function requireGateway(): void
{
require_once __DIR__.'/Woocommerce/WC_Gateway_Economic_Invoice.php';
if (! class_exists('WC_Payment_Gateway')) {
return;
}
require_once __DIR__ . '/Woocommerce/WC_Gateway_Economic_Invoice.php';
}
}

0 comments on commit cdd5c41

Please sign in to comment.