woocommerce-rest-api

How to do custom pagination using woocommerce rest api in my android app?

老子叫甜甜 提交于 2020-03-06 03:10:30
问题 In my android app I am using woocommerce rest api to fetch products from my inventory. As per the documentation "Requests that return multiple items will be paginated to 10 items by default." I need to fetch 25 items per request. As per the documentation I have tried many things but unfortunately I didn't get any success. For pagination I tried "mysite/wc-api/v3/products/"+"?page="+pageNum; Using this I get first 10 products for pageNum = 1, 11-20 i.e next set of 10 items using pageNum = 2

How do can I extend woocommerce api endpoints?

試著忘記壹切 提交于 2020-01-23 13:10:50
问题 I'm trying to extend the customer endpoint in woocommerce api to include some customfields I've created in my functions.php. But I can't understand how to do it. I have copied the class-wc-rest-customers-controller.php from the woocommerce plugin (woocommerce/includes/api/) to my woocommerce-folder in my theme as you should do with woocommerce files when you want to edit them. This is how my class-wc-rest-customers-controller.php looks like: https://www.pastebucket.com/561405 My plan now was

“cannot list resources” error from WooCommerce REST API

大城市里の小女人 提交于 2019-12-30 09:57:04
问题 I am very new to WordPres` and using the WooCommerce plugin for the first time and want to use the WooCommerce REST API in my Android app. I have enabled the REST API and created a Consumer Key as well as a Consumer secret. Now, when am using this url http://www.my-domain.com/wp-json/wc/v1/products/ in my browser to check if the API is working or not, I get this error: {"code":"woocommerce_rest_cannot_view","message":"Sorry, you cannot list resources.","data":{"status":401}} SSL is not

Android-Cant create order using woocommerce api

两盒软妹~` 提交于 2019-12-25 10:21:28
问题 Cant create order using WooCommerce API The android code (okhttp) is RequestBody formBody = new MultipartBody.Builder() .setType(MultipartBody.FORM) .addFormDataPart(oauthConsumerKeyString, oauthConsumerKeyStringValue) .addFormDataPart(oauthNonceKeyString, oauthNonceKeyValue) .addFormDataPart(oauthSignatureMethodKey, oauthSignatureMethodKeyValue) .addFormDataPart(oauthTimestampKeyString, oauthTimeStampKeyStringValue) .addFormDataPart("oauth_signature", signature) .addFormDataPart("orders",

Android-Cant create order using woocommerce api

梦想的初衷 提交于 2019-12-25 10:21:12
问题 Cant create order using WooCommerce API The android code (okhttp) is RequestBody formBody = new MultipartBody.Builder() .setType(MultipartBody.FORM) .addFormDataPart(oauthConsumerKeyString, oauthConsumerKeyStringValue) .addFormDataPart(oauthNonceKeyString, oauthNonceKeyValue) .addFormDataPart(oauthSignatureMethodKey, oauthSignatureMethodKeyValue) .addFormDataPart(oauthTimestampKeyString, oauthTimeStampKeyStringValue) .addFormDataPart("oauth_signature", signature) .addFormDataPart("orders",

No product data specified to create product [woocommerce_api_missing_product_data]

怎甘沉沦 提交于 2019-12-25 09:02:58
问题 I have downloaded latest repository of woocommerce php API. I have been following woocommerce REST API Docs to create a test product. I have copied the sample from their documentation but it is not working. Here is my code. API docs : http://woocommerce.github.io/woocommerce-rest-api-docs/?php#create-a-product <?php require_once("vendor/autoload.php"); use Automattic\WooCommerce\Client; $woocommerce = new Client( 'http://wocom.dev', 'ck_c62182de9983593c9da6ed5c4642ff50e79e1b4f', 'cs

How to extend woocommerce api to show bookable product availability rules?

半腔热情 提交于 2019-12-24 19:49:53
问题 I've made a custom plugin with a custom api end point. I would like to access my bookable products availability times so I can use the api with a react front end. So far I have this function that my custom endpoint is attached to: function get_data() { $args = array( 'limit' => 1, 'type' => 'booking', ); $products = wc_get_products( $args ); return $products; } When I call my end point in postman all I get is this: Why is the array for availability_rules empty and why is there no other

Creating WooCommerce Custom API

泄露秘密 提交于 2019-12-24 18:43:46
问题 I'm looking into creating a WooCommerce endpoint due to the lack of many functionalities in the WooCommerce REST API provided out of the box. Examples are : Payment, Product-Addons, etc But I can't find anything to start with, no documentation on how to extend WooCommerce to create a new endpoint. All I could find was creating a Plugin, but I'm not sure if that's what I need. I want to create php files when called return the desired data like products and orders. I've tried adding actions and

Ionic 3 WP-REST API Post request 401 (unauthorized) error

浪子不回头ぞ 提交于 2019-12-24 18:23:21
问题 I am developing a simple application to create a user in Wordpress (woocommerce) through wp-rest api. but when I try to create a new customers it shows 401 Unauthorised error in console. heres is my code for request. signup(){ let customerData = { customer : {} } customerData.customer = { "email": this.newUser.email, "first_name": this.newUser.first_name, ... "billing_address": { "first_name": this.newUser.first_name, ... }, "shipping_address": { "first_name": this.newUser.first_name, ... } }

WooCommerce REST API - Get Custom Fields for Order

天涯浪子 提交于 2019-12-22 10:19:13
问题 I'm using the WooCommerce REST API (http://woocommerce.github.io/woocommerce-rest-api-docs/#introduction) and are able to download Customers, Orders etc successfully. My customer has added some custom fields to the checkout page, e.g.: po_number accounts_email I would like to be able to GET these custom fields when requesting an ORDER, e.g.: /wp-json/wc/v1/orders/4568 At the moment none of the custom fields are returned when I GET an Order. I've tried adding ?filter[meta]=true to the request