Steps to Verify Woocommerce in Android App

The most important thing that we are going to share with you guys today, that is how to verify woocommerce in android app. Let’s check out the steps for Woocommerce authentication in Android app

Verify Woocommerce in Android App

WooCommerce Settings

1. Login to WordPress site, menu will be displayed at left side of page from there select WooCommerce and select Settings menu under WooCommerce menu.

 

Woocommerce in Android App

 

2. Setting options will appear in the content window select API tab. And select settings under API section. Check the Enable REST API checkbox to allow rest api access.

 

Woocommerce in Android App 2

 

3. Select Keys/Apps tab under API section to add a key for user and click Add key button, add a description for the key and select user for which key will be generated. Always select Permission as Read/Write to have access to REST API for GET and POST methods.

Woocommerce in Android App 3

4. Add key by providing details. And click on Generate API key button Consumer key and consumer secret keys will be generated

Woocommerce in Android App 4

Android Setting

1. Add scribe library to android project in app/libs folder.
2. Add the consumer key and consumer secret key in Strings.xml file

Woocommerce in Android App 5
3. Create an oAuth service by providing consumer key and consumer secret key to request oAuth token for authorization.

Woocommerce in Android App 6
4. Create an oAuth request with request method:

? For GET method:

Woocommerce in Android App 7
? For POST method:

Woocommerce in Android App 8
final Object being the JSONOBJECT with all required parameter values to post to API.

5. Send scribe signed request based on the async http client method to construct a signed request for oAuth service. And send the request to server.

Woocommerce in Android App 9

 

Woocommerce in Android App 10

Get Products From Woocommerce Store:

1. Call the products API and pass category ids in URL, it will list all products of a category. It might be possible that a category have subcategories in it, in that case pass all subcategories with URL and all products for all subcategories mentioned in URL will be listed

2. In product response each product will have categories array, will list categories under which product lies, get thode category name or category id and filter products on subcategory ids. Suppose Category1 has three subcategories then pass all three subcategory ids in products api.

http://your_wordpress_site/wordpress/wp-json/wc/v2/products/?category=26,27,28
Product response will have categories array:

[code]
"categories": [
{
"id": 26,
"name": "Subcategory",
"slug": "subcategory"
}
],
[/code]

While displaying subcategory with its products, filter this list based on current subcategory we are displaying.

Avyatech Logo