mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Merge branch 'trunk' into fix/PCP-1677-fraudnet_scripts_in_SGO_filter
This commit is contained in:
commit
0bfb1bec16
124 changed files with 9478 additions and 789 deletions
|
@ -67,8 +67,12 @@ class PPECHelper {
|
|||
* @return bool
|
||||
*/
|
||||
public static function site_has_ppec_subscriptions() {
|
||||
global $wpdb;
|
||||
$has_ppec_subscriptions = get_transient( 'ppcp_has_ppec_subscriptions' );
|
||||
if ( $has_ppec_subscriptions !== false ) {
|
||||
return $has_ppec_subscriptions === 'true';
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
$result = $wpdb->get_var(
|
||||
$wpdb->prepare(
|
||||
"SELECT 1 FROM {$wpdb->posts} p JOIN {$wpdb->postmeta} pm ON pm.post_id = p.ID
|
||||
|
@ -80,6 +84,12 @@ class PPECHelper {
|
|||
)
|
||||
);
|
||||
|
||||
set_transient(
|
||||
'ppcp_has_ppec_subscriptions',
|
||||
! empty( $result ) ? 'true' : 'false',
|
||||
3 * MONTH_IN_SECONDS
|
||||
);
|
||||
|
||||
return ! empty( $result );
|
||||
}
|
||||
|
||||
|
@ -92,7 +102,9 @@ class PPECHelper {
|
|||
/**
|
||||
* The filter returning whether the compatibility layer for PPEC Subscriptions should be initialized.
|
||||
*/
|
||||
return ( ! self::is_gateway_available() ) && self::site_has_ppec_subscriptions() && apply_filters( 'woocommerce_paypal_payments_process_legacy_subscriptions', true );
|
||||
return ( ! self::is_gateway_available() )
|
||||
&& self::site_has_ppec_subscriptions()
|
||||
&& apply_filters( 'woocommerce_paypal_payments_process_legacy_subscriptions', true );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ class SubscriptionsHandler {
|
|||
/**
|
||||
* Adds a mock gateway to disguise as PPEC when needed. Hooked onto `woocommerce_payment_gateways`.
|
||||
* The mock gateway fixes display issues where subscriptions paid via PPEC appear as "via Manual Renewal" and also
|
||||
* prevents Subscriptions from automatically changing the payment method to "manual" when a subscription is edited.
|
||||
* prevents subscriptions from automatically changing the payment method to "manual" when a subscription is edited.
|
||||
*
|
||||
* @param array $gateways List of gateways.
|
||||
* @return array
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue