WooCommerce’s /wc/store/products and /wc/store/products/reviews Store API endpoints now require a per_page minimum of 1. This means that it is no longer possible to use a per_page=0 argument to load all of a store’s products, and instead, pagination must be used to retrieve them in batches. This was originally a deliberate design choice, however, in practice, we found that it too easily enables developers to degrade the performance of a store unintentionally.
How can developers tell if they are affected?
Since the default per_page has always been 10, the only people affected are those intentionally calling these endpoints with per_page=0. After updating, the REST API will begin returning 400 status codes indicating that per_page must be between 1 and 100.
What action do developers need to take if affected?
The correct approach is for any developer using per_page=0 on these endpoints to begin using per_page=100&page={page} requests to load the products in batches. We would also encourage even smaller batches to improve response times when the data is being served directly to users.
In the interim, however, the following snippet will re-enable support for per_page=0 on these routes:
<?php
add_filter( 'rest_endpoints', function ( $endpoints ) {
$routes = array( '/wc/store/products', '/wc/store/products/reviews' );
foreach ( $routes as $route ) {
if ( ! isset( $endpoints[ $route ] ) ) {
return $endpoints;
}
foreach ( $endpoints[ $route ] as &$handler ) {
if ( isset( $handler['args']['per_page'] ) && is_array( $handler['args']['per_page'] ) ) {
$handler['args']['per_page']['minimum'] = 0;
}
}
}
return $endpoints;
});This change will be included in WooCommerce 10.6, currently scheduled for March 10, 2026.
Related PR: woocommerce/woocommerce#61755
Leave a Reply