mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 16:24:33 +08:00
Use orders table if hpos is enabled
This commit is contained in:
parent
66f29789fb
commit
9b589c6040
1 changed files with 20 additions and 9 deletions
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
namespace WooCommerce\PayPalCommerce\Compat\PPEC;
|
namespace WooCommerce\PayPalCommerce\Compat\PPEC;
|
||||||
|
|
||||||
|
use Automattic\WooCommerce\Utilities\OrderUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper class with various constants associated to the PayPal Express Checkout plugin, as well as methods for figuring
|
* Helper class with various constants associated to the PayPal Express Checkout plugin, as well as methods for figuring
|
||||||
* out the status of the gateway.
|
* out the status of the gateway.
|
||||||
|
@ -73,6 +75,14 @@ class PPECHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
if ( class_exists( OrderUtil::class ) && OrderUtil::custom_orders_table_usage_is_enabled() ) {
|
||||||
|
$result = $wpdb->get_var(
|
||||||
|
$wpdb->prepare(
|
||||||
|
"SELECT 1 FROM {$wpdb->wc_orders} WHERE payment_method = %s",
|
||||||
|
'ppec_paypal'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
$result = $wpdb->get_var(
|
$result = $wpdb->get_var(
|
||||||
$wpdb->prepare(
|
$wpdb->prepare(
|
||||||
"SELECT 1 FROM {$wpdb->posts} p JOIN {$wpdb->postmeta} pm ON pm.post_id = p.ID
|
"SELECT 1 FROM {$wpdb->posts} p JOIN {$wpdb->postmeta} pm ON pm.post_id = p.ID
|
||||||
|
@ -83,6 +93,7 @@ class PPECHelper {
|
||||||
self::PPEC_GATEWAY_ID
|
self::PPEC_GATEWAY_ID
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set_transient(
|
set_transient(
|
||||||
'ppcp_has_ppec_subscriptions',
|
'ppcp_has_ppec_subscriptions',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue