Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wordpress Woocommerce - REST API limitation to up to 100 objects

As the documentation of woocommerce REST API (v3) stated, by default the REST API is limited to up to 100 objects to be created, updated or deleted. https://woocommerce.github.io/woocommerce-rest-api-docs/#batch-update-products I'm wondering if it is possible to remove this limitation totally or set the limit a bit higher (to 1000 or so). Thanks!

like image 236
nightm0re Avatar asked May 27 '20 17:05

nightm0re


People also ask

What can you do with WooCommerce REST API?

The WooCommerce REST API is an interface that you can use to access your WooCommerce store from outside WordPress. It was designed to make it easy for WooCommerce stores on WordPress to interact with other websites and applications over the Internet.

How do I enable REST API in WooCommerce?

To enable the legacy REST API within WooCommerce, go to WooCommerce > Settings > Advanced > Legacy API and tick the Enable the legacy REST API checkbox.


2 Answers

Finally found the answer here: https://wordpress.stackexchange.com/questions/304237/increase-product-variation-limit-in-woocommerce

just add the lines below to wp-includes/functions.php

function wpse_rest_batch_items_limit( $limit ) {
    $limit = 1000;

    return $limit;
}
add_filter( 'woocommerce_rest_batch_items_limit', 'wpse_rest_batch_items_limit' );
like image 162
nightm0re Avatar answered Oct 21 '22 03:10

nightm0re


Hello Try This code in function.php

function update_limit_for_products( $limit, $products ) {
    $limit = 1000;

    return $limit;

}

add_filter( 'woocommerce_api_bulk_limit', 'update_limit_for_products', 10, 2 );
like image 24
pro4soft Avatar answered Oct 21 '22 03:10

pro4soft