woocommerce-rest-api

WooCommerce REST API Custom Fields

浪子不回头ぞ 提交于 2019-12-04 19:34:28
问题 Is it possible to access custom fields for orders, products, customers via WooCommerce REST API? If not natively, then what plugins or workarounds or hacks are out there that work? Thanks! 回答1: Answering my own question: It is possible using the following: (using v3 legacy API) To send custom fields back to the server: (For Orders) { "order_meta": { "key": "value" } } To retrieve custom fields from server use this filter with your end point: http://www.example.com/wc-api/v3/orders?filter[meta

Woocommerce REST API 401

我只是一个虾纸丫 提交于 2019-12-04 05:21:20
问题 similar question has been asked before however I am not sure if the proposed solutions can be applied in my case. I have generated consumerKey and consumerSecret as per the woocommerce api documentation. I have confirmed that I can get the results using these keys by calling the below url in the webbrowser: https://mywebsite.com/wp-json/wc/v2/products?consumer_key=ck_blahblah&consumer_secret=cs_blahblah However, when I execute the same api call in the postman, using GET and correctly

What WooCommerce API should I use on the server?

半城伤御伤魂 提交于 2019-12-03 17:17:52
I am writing a script to bulk-change product properties such as price, weight and dimension. I need to run the script directly on the server where WordPress (4.7.2) and WooCommerce (2.6.13) are installed. The options I could think of don't seem ideal to me: WooCommerce non-REST API would be my obvious choice, but it is relegated into a scary legacy folder which smells of deprecated. WooCommerce REST API ( link ) seems overkill: why should I go through authentication and use HTTP when I am already on the server and can just use PHP? Acting on the database via update_post_meta() seems error

WooCommerce REST API Custom Fields

萝らか妹 提交于 2019-12-03 12:19:36
Is it possible to access custom fields for orders, products, customers via WooCommerce REST API? If not natively, then what plugins or workarounds or hacks are out there that work? Thanks! Answering my own question: It is possible using the following: (using v3 legacy API) To send custom fields back to the server: (For Orders) { "order_meta": { "key": "value" } } To retrieve custom fields from server use this filter with your end point: http://www.example.com/wc-api/v3/orders?filter[meta]=true This works for Products as well. As mentioned in the comment after WooCommerce creates an order via

Use woocommerce rest api v1 with http and javascript (not https)

烈酒焚心 提交于 2019-12-02 18:31:27
问题 Im using oauth-signature to generate my oauth-signature for connection with woocommerce api. I followed all the steps stated at woocommerce rest api documentation: The required parameters are: oauth_consumer_key, oauth_timestamp, oauth_nonce, oauth_signature, and oauth_signature_method . oauth_version is not required and should be omitted. The OAuth nonce can be any randomly generated 32 character (recommended) string that is unique to the consumer key. etc... But the following request still

WooCommerce + Ionic: Unable to signup and checkout - Fetch API cannot load

邮差的信 提交于 2019-12-02 13:15:29
I am working on a project that integrates WooCommerce with Ionic 3 and I am having problems with the signup and checkout functionality. I am able to read products and login from my WooCommerce site, but every time I do a post request, I am getting these errors: {"errors":[{"code":"woocommerce_api_authentication_error","message":"Invalid signature - provided signature does not match."}]} How can I fix it? Make sure you have the following code in your .htaccess file on the top. You can find this file in the root of your WordPress. RewriteEngine On RewriteCond %{REQUEST_METHOD} OPTIONS

Use woocommerce rest api v1 with http and javascript (not https)

白昼怎懂夜的黑 提交于 2019-12-02 09:43:54
Im using oauth-signature to generate my oauth-signature for connection with woocommerce api. I followed all the steps stated at woocommerce rest api documentation : The required parameters are: oauth_consumer_key, oauth_timestamp, oauth_nonce, oauth_signature, and oauth_signature_method . oauth_version is not required and should be omitted. The OAuth nonce can be any randomly generated 32 character (recommended) string that is unique to the consumer key. etc... But the following request still returns unauthorized: http://siglar.no/wp-json/wc/v1/orders?oauth_consumer_key=ck

Extending the woocommerce rest api

旧巷老猫 提交于 2019-12-02 04:20:48
I would like to extend the woocommerce rest api to include data of its 'booking' extension plugin. Currently this extension does not have default endpoints provided by the rest api. So far I have created a plugin, and I've added the following code; add_filter( 'woocommerce_rest_prepare_product', 'custom_data'); function custom_data($response, $object) { if( empty( $response->data ) ) return $response; $response->data['meta_data'] = get_post_meta( $object[ID], 'availability', true); return $response; } When I call the end point /products only the default data outlined by woocommerce is still

“cannot list resources” error from WooCommerce REST API

和自甴很熟 提交于 2019-12-01 09:30:49
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 installed on my server. How can I fix this? Do I need to use the PHP Client Library? For the "new" v2 API

WooCommerce - woocommerce_rest_cannot_view - Status 401

天大地大妈咪最大 提交于 2019-12-01 02:07:59
问题 I have generated a consumer key and consumer secret. The website has SSL installed. I have also installed plugins required for JSON and REST services. This is how the url looks like: https://<url>/wp-json/wc/v1/products When I am trying to get(GET) the product details using Basic Auth by using POSTMAN, a Chrome plugin, I get a JSON response like: { "code": "woocommerce_rest_cannot_view", "message": "Sorry, you cannot list resources.", "data": { "status": 401 } } I have both the READ and WRITE