第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Woocommerce API per_page react native 中的最大限制

Woocommerce API per_page react native 中的最大限制

PHP
翻翻過去那場雪 2022-08-19 10:38:43
我正在構建一個電子商務移動應用程序,其中包含react native和woocommerce,我面臨著這個問題。per_page不起作用這是代碼import WooCommerceAPI from 'react-native-woocommerce-api';const WooCommerce = new WooCommerceAPI({  url: 'http://example.com/', // Your store URL  ssl: false,  consumerKey: 'ck_xxxxxxxxxxx', // Your consumer key  consumerSecret: 'cs_xxxxxxxxxxx', // Your consumer secret  wpAPI: true, // Enable the WP REST API integration  version: 'wc/v3', // WooCommerce WP REST API version  queryStringAuth: true});然后  componentDidMount() {    WooCommerce.get('products?per_page=50', {})      .then(res => {        this.setState({          data: res,          isLoading: false        });      })      .catch(error => {        console.log(error);        this.setState({          error,          isLoading: true        });      });  }然后    console.log(this.state.data);我在控制臺得到了這個對象 { “code”: “woocommerce_rest_authentication_error”, “data”: Object { “status”: 401, }, “message”: “無效的簽名 - 提供的簽名不匹配。如果我寫它得到10產品作為woocommerce API的最大限制,但我需要得到所有產品WooCommerce.get('products', {})
查看完整描述

3 回答

?
慕神8447489

TA貢獻1780條經(jīng)驗 獲得超1個贊

Open react-native-woocommerce-api.js in node_modules\react-native-woocommerce-api\lib\


然后轉到第 195 行(_getOAuth().authorize 函數(shù))并更改:


params.qs = this._getOAuth().authorize({

  url: url,

  method: method

});


params.qs = this._getOAuth().authorize({

  url: url + '?' + this.join(data, '&'),

  method: method

});


查看完整回答
反對 回復 2022-08-19
?
慕萊塢森

TA貢獻1810條經(jīng)驗 獲得超4個贊

 WooCommerce.get('products?per_page=100&page=1', {}) // YOu can set a Variable in-place of 1 and index 100 is the limit

較舊的 API 版本

https://Yoursite/wc-api/v3/products?filter[limit] =-1

希望這有幫助


查看完整回答
反對 回復 2022-08-19
?
大話西游666

TA貢獻1817條經(jīng)驗 獲得超14個贊

 WooCommerce.get('products', {per_page: 50})

  .then(res => {

    this.setState({

      data: res,

      isLoading: false

    });


  })

  .catch(error => {

    console.log(error);

    this.setState({

      error,

      isLoading: true

    });

  });

這應該有效!


查看完整回答
反對 回復 2022-08-19
  • 3 回答
  • 0 關注
  • 121 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號