* Call existing filters for leaderboards.
Fixes category data not refreshing when selecting a different currency while using docs/examples/extensions/sql-modification

* Update changelog

Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
This commit is contained in:
David Garcia Watkins 2021-05-18 09:14:28 +02:00 committed by GitHub
parent 9cce902c84
commit 9bd4eef17e
2 changed files with 40 additions and 27 deletions

View File

@ -108,6 +108,7 @@ Release and roadmap notes are available on the [WooCommerce Developers Blog](htt
- Fix: Exclude WC Shipping for store that are only offering downloadable products #6917
- Fix: SelectControl focus and de-focus bug #6906
- Fix: Multiple preload tag output bug. #6998
- Fix: Call existing filters for leaderboards in analytics. #6626
- Tweak: Only fetch remote payment gateway recommendations when opted in #6964
- Update: Task list component with new Experimental Task list. #6849
- Update: Experimental task list import to the experimental package. #6950

View File

@ -77,13 +77,16 @@ class Leaderboards extends \WC_REST_Data_Controller {
public function get_coupons_leaderboard( $per_page, $after, $before, $persisted_query ) {
$coupons_data_store = new CouponsDataStore();
$coupons_data = $per_page > 0 ? $coupons_data_store->get_data(
array(
'orderby' => 'orders_count',
'order' => 'desc',
'after' => $after,
'before' => $before,
'per_page' => $per_page,
'extended_info' => true,
apply_filters(
'woocommerce_analytics_coupons_query_args',
array(
'orderby' => 'orders_count',
'order' => 'desc',
'after' => $after,
'before' => $before,
'per_page' => $per_page,
'extended_info' => true,
)
)
)->data : array();
@ -143,13 +146,16 @@ class Leaderboards extends \WC_REST_Data_Controller {
public function get_categories_leaderboard( $per_page, $after, $before, $persisted_query ) {
$categories_data_store = new CategoriesDataStore();
$categories_data = $per_page > 0 ? $categories_data_store->get_data(
array(
'orderby' => 'items_sold',
'order' => 'desc',
'after' => $after,
'before' => $before,
'per_page' => $per_page,
'extended_info' => true,
apply_filters(
'woocommerce_analytics_categories_query_args',
array(
'orderby' => 'items_sold',
'order' => 'desc',
'after' => $after,
'before' => $before,
'per_page' => $per_page,
'extended_info' => true,
)
)
)->data : array();
@ -209,12 +215,15 @@ class Leaderboards extends \WC_REST_Data_Controller {
public function get_customers_leaderboard( $per_page, $after, $before, $persisted_query ) {
$customers_data_store = new CustomersDataStore();
$customers_data = $per_page > 0 ? $customers_data_store->get_data(
array(
'orderby' => 'total_spend',
'order' => 'desc',
'order_after' => $after,
'order_before' => $before,
'per_page' => $per_page,
apply_filters(
'woocommerce_analytics_customers_query_args',
array(
'orderby' => 'total_spend',
'order' => 'desc',
'order_after' => $after,
'order_before' => $before,
'per_page' => $per_page,
)
)
)->data : array();
@ -273,13 +282,16 @@ class Leaderboards extends \WC_REST_Data_Controller {
public function get_products_leaderboard( $per_page, $after, $before, $persisted_query ) {
$products_data_store = new ProductsDataStore();
$products_data = $per_page > 0 ? $products_data_store->get_data(
array(
'orderby' => 'items_sold',
'order' => 'desc',
'after' => $after,
'before' => $before,
'per_page' => $per_page,
'extended_info' => true,
apply_filters(
'woocommerce_analytics_products_query_args',
array(
'orderby' => 'items_sold',
'order' => 'desc',
'after' => $after,
'before' => $before,
'per_page' => $per_page,
'extended_info' => true,
)
)
)->data : array();