File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -221,13 +221,21 @@ public function exportProducts(WP_REST_Request $request) {
221221
222222 $ product_data [] = Helpers::getProductData ($ product ->ID );
223223 }
224-
224+
225+ if (!isset ($ _GET ['ignoreCount ' ])) {
226+ $ products_count = wp_count_posts ( $ post_type = 'product ' );
227+ $ product_variation_count = wp_count_posts ( $ post_type = 'product_variation ' );
228+ $ product_found = ($ products_count ->publish + $ product_variation_count ->publish );
229+ } else {
230+ $ product_found = null ;
231+ }
232+
225233 return new WP_REST_Response ([
226234 'content ' => $ product_data ,
227235 'pagination ' => [
228236 'limit ' => $ limit ,
229237 'offset ' => $ offset ,
230- 'found ' => count ( $ product_data )
238+ 'found ' => $ product_found
231239 ]
232240 ]);
233241 }
You can’t perform that action at this time.
0 commit comments