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,21 +342,18 @@ class CompatModule implements ModuleInterface {
'wp',
function() {
$page_id = get_the_ID();
if ( $page_id ) {
if ( CartCheckoutDetector::has_elementor_checkout( $page_id ) ) {
if ( ! $page_id || ! 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;
return ( 'mini-cart' === $context ) ? 'checkout' : $context;
}
);
}
}
}
);
}
}