Reduce nested conditions

This commit is contained in:
Daniel Dudzic 2024-05-29 22:17:34 +02:00
parent 709871820f
commit 14b20a6962
No known key found for this signature in database
GPG key ID: 31B40D33E3465483

View file

@ -342,20 +342,17 @@ class CompatModule implements ModuleInterface {
'wp', 'wp',
function() { function() {
$page_id = get_the_ID(); $page_id = get_the_ID();
if ( $page_id ) { if ( ! $page_id || ! CartCheckoutDetector::has_elementor_checkout( $page_id ) ) {
if ( CartCheckoutDetector::has_elementor_checkout( $page_id ) ) { return;
add_filter(
'woocommerce_paypal_payments_context',
function ( $context ): string {
// Default context.
if ( 'mini-cart' === $context ) {
return 'checkout';
}
return $context;
}
);
}
} }
add_filter(
'woocommerce_paypal_payments_context',
function ( $context ): string {
// Default context.
return ( 'mini-cart' === $context ) ? 'checkout' : $context;
}
);
} }
); );
} }