Our wcs_get_subscription_orders() function still contains the following code that is incompatible with stores with HPOS enabled and not syncing to WP Posts table:
if ( $any_order_type || in_array( 'parent', $order_type ) ) {
$order_ids = array_merge( $order_ids, $wpdb->get_col(
"SELECT DISTINCT post_parent FROM {$wpdb->posts}
WHERE post_type = 'shop_subscription'
AND post_parent <> 0"
) );
}
Note that this function is still querying the {$wpdb->posts} table for post parents 🙈
To Reproduce
Go to WooCommerce > Settings > Advanced and enable High-Performance order storage (COT)
Go to the Custom data stores tab under Advanced settings and switch your store to Order Tables.
Disable the "Keep the posts table and the orders tables synchronized" option
Purchase a new subscription
Run the following snippet wcs_get_subscription_orders( 'ids' ); and notice the new parent order is not returned.
Expected behavior
Actual behavior
Product impact
[x] Does this issue affect WooCommerce Subscriptions?
Describe the bug
Our
wcs_get_subscription_orders()
function still contains the following code that is incompatible with stores with HPOS enabled and not syncing to WP Posts table:Note that this function is still querying the
{$wpdb->posts}
table for post parents 🙈To Reproduce
wcs_get_subscription_orders( 'ids' );
and notice the new parent order is not returned.Expected behavior
Actual behavior
Product impact