Display the "shop_order_subtype" filter dropdown when HPOS is enabled. We're using the HPOS-specific woocommerce_order_list_table_restrict_manage_orders action to hook the same functionality that WC_Subscriptions_Order::restrict_manage_subscriptions has.
Filter the arguments passed to wc_get_orders() when a value from the dropdown is selected and HPOS is enabled. We're using the HPOS-specific woocommerce_{ order type }_list_table_prepare_items_query_args filter for this, to perform the same functionality that WC_Subscriptions_Order::orders_by_type_query() does.
How to test this PR
Go to WooCommerce -> Settings -> Advanced -> Features. /wp-admin/admin.php?page=wc-settings&tab=advanced§ion=features
Under Experimental features, select "High performance order storage (new)", enable "Keep the posts and orders tables in sync (compatibility mode)", and save
Go to WooCommerce -> Orders. /wp-admin/admin.php?page=wc-orders
Confirm that the "shop_order_subtype" dropdown filter shows up next to "Filter by registered customer"
As a shopper, get the following if you don't have them already:
A subscription
A renewal for the subscription
A resubscribed subscription
An order with a non-subscription product
A switched subscription
Go to WooCommerce -> Orders
Filter by each option from the dropdown and confirm that the results match the filter. Because we're missing the "Subscription relationship" column, I used the results from when "WordPress post tables" is enabled instead of HPOS as a reference
Product impact
[x] Added changelog entry (or does not apply)
[ ] Will this PR affect WooCommerce Subscriptions? yes/no/tbc, add issue ref
[ ] Will this PR affect WooCommerce Payments? yes/no/tbc, add issue ref
[ ] Added deprecated functions, hooks or classes to the spreadsheet
Fixes #496
Description
woocommerce_order_list_table_restrict_manage_orders
action to hook the same functionality thatWC_Subscriptions_Order::restrict_manage_subscriptions
has.wc_get_orders()
when a value from the dropdown is selected and HPOS is enabled. We're using the HPOS-specificwoocommerce_{ order type }_list_table_prepare_items_query_args
filter for this, to perform the same functionality thatWC_Subscriptions_Order::orders_by_type_query()
does.How to test this PR
/wp-admin/admin.php?page=wc-settings&tab=advanced§ion=features
/wp-admin/admin.php?page=wc-orders
Product impact