Skip to content

Commit

Permalink
Merge pull request #2697 from woocommerce/fix/PCP-3317-check-setting-…
Browse files Browse the repository at this point in the history
…exist

Ensure setting exist before getting it (3317)
  • Loading branch information
Dinamiko authored Oct 14, 2024
2 parents a282260 + a16ab58 commit 8c15d6e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/ppcp-blocks/src/BlocksModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ModuleClassNameIdTrait;
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ServiceModule;
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;

/**
* Class BlocksModule
Expand Down Expand Up @@ -70,9 +71,10 @@ function( PaymentMethodRegistry $payment_method_registry ) use ( $c ): void {
$payment_method_registry->register( $c->get( 'blocks.method' ) );

$settings = $c->get( 'wcgateway.settings' );
assert( $settings instanceof Settings );

// Include ACDC in the Block Checkout only in case Axo doesn't exist or is not available or the user is logged in.
if ( ! $settings->get( 'axo_enabled' ) || is_user_logged_in() ) {
if ( ( $settings->has( 'axo_enabled' ) && ! $settings->get( 'axo_enabled' ) ) || is_user_logged_in() ) {
$payment_method_registry->register( $c->get( 'blocks.advanced-card-method' ) );
}
}
Expand Down

0 comments on commit 8c15d6e

Please sign in to comment.