Remove limit from coupons query when getting the total count (https://github.com/woocommerce/woocommerce-admin/pull/8001)

* Remove limit from coupons query when getting the total count.

* Add changelog
This commit is contained in:
louwie17 2021-12-04 14:29:12 -04:00 committed by GitHub
parent 5f8db47c16
commit 6c2fbce0c0
2 changed files with 5 additions and 1 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: Fix
Fix pagination issue with Analytics Coupons page. #8001

View File

@ -283,7 +283,7 @@ class DataStore extends ReportsDataStore implements DataStoreInterface {
$this->subquery->add_sql_clause( 'limit', $this->get_sql_clause( 'limit' ) );
$coupons_query = $this->subquery->get_query_statement();
$this->subquery->clear_sql_clause( array( 'select', 'order_by' ) );
$this->subquery->clear_sql_clause( array( 'select', 'order_by', 'limit' ) );
$this->subquery->add_sql_clause( 'select', 'coupon_id' );
$coupon_subquery = "SELECT COUNT(*) FROM (
{$this->subquery->get_query_statement()}