Use date created and status order filter for order eligiblity check

Using these two order properties instead of the paid_date field is more performance friendly
as both fields are in the wp-posts table - not in the post_meta table.

ref: 71e9657e52 (r875545984)
This commit is contained in:
James Allan 2022-05-19 10:42:46 +10:00
parent 98e23a8156
commit 3aa2294968
1 changed files with 4 additions and 3 deletions

View File

@ -151,9 +151,10 @@ class WcPaySubscriptionsPage {
// Get a single order that has been paid within the last 30 days. // Get a single order that has been paid within the last 30 days.
$orders = wc_get_orders( $orders = wc_get_orders(
array( array(
'date_paid' => '>' . strtotime( '-30 days' ), 'date_created' => '>' . strtotime( '-30 days' ),
'limit' => 1, 'status' => wc_get_is_paid_statuses(),
'return' => 'ids', 'limit' => 1,
'return' => 'ids',
) )
); );