Closed mattallan closed 1 year ago
These changes look good to me and work well.
I've tested filtering the subscription list table on HPOS and CPT environments using various combinations of payment method, customer and product. All searches returned appropriate results.
Fixes #334
Description
The Subscriptions List Table allows store managers to filter subscriptions by product, customer and payment method, however, these filters weren't working when HPOS is enabled:
On non-HPOS stores, we are hooking onto the
request
filter and modifying the WP Query to return results based on the filters set in GET params. However thisrequest
filter isn't used on the new WC Orders List Table page.On stores that have HPOS enabled, WooCommerce has provided a new hook that lets us filter the table results by modifying the params sent to
wc_get_orders()
.This PR fixes being able to filter the Subscriptions List Table by implementing the following changes:
woocommerce_shop_subscription_list_table_prepare_items_query_args
hook which filters the query args that get passed towc_get_orders()
.request
to filter customers, products and payment methods into separate functions.wcs_get_subscriptions_for_product()
to also work on stores that have HPOS enabled.How to test this PR
Product impact