Get all products from Woocommerce using REST API

后端 未结 7 1892
鱼传尺愫
鱼传尺愫 2020-12-18 16:12

I am trying to retrieve all products using rest api. I have read this question. I am using postman to make calls. Here is my query

https://squatwolf.com/wp-j         


        
7条回答
  •  醉梦人生
    2020-12-18 16:49

    This worked for me. With API v3

    /wc-api/v3/products?
    

    Retrieve first 500 products by default or

    /wc-api/v3/products?per_page=900
    

    To get 900 products

    function maximum_api_filter($query_params) {
       $query_params['per_page']['maximum'] = 10000;
       $query_params['per_page']['default'] = 500;
       return $query_params;
    }
    add_filter('rest_product_collection_params', 'maximum_api_filter', 10, 1 );
    

提交回复
热议问题