Getting all woocommerce products from REST API call in plugin


I am developing a plugin that extends Woocommerce and acts as a custom product filter. The part I’m having trouble with is that it’s not tied to one specific site, and has to fetch the products from an external API call, which is limited by 100 results per page, and I need just under 1000 products. I would prefer to get this data with one call only, without needing some hacky loop to glue together the results of the individual page calls. It seems that the only (recommended) way around this limit is to use some variation of the wc_get_products method, with the limit set to -1 to return all products. But I don’t see how to apply that method without one clear parent site, and if I could do so, how to transform the API call function into a format that wc_get_products could read without initially limiting it to the first 100 product results.

, , , Michael C 4 years 2020-03-04T11:51:08-05:00 0 Answers 100 views 0

Leave an answer