mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 09:08:09 +08:00
Reduce nested conditions
This commit is contained in:
parent
709871820f
commit
14b20a6962
1 changed files with 10 additions and 13 deletions
|
@ -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;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue