The most important thing that we are going to share with you guys today, that is how to verify woocommerce in the android app. Let’s check out the steps for Woocommerce authentication in the Android app.
Verify Woocommerce in Android App
1. Login to a WordPress site, the menu will be displayed at the left side of the page from there select WooCommerce and select Settings menu under WooCommerce menu.
2. Setting options will appear in the content window select the API tab. And select settings under the API section. Check the Enable REST API checkbox to allow rest API access.
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.
1. Add scribe library to android project in app/libs folder.
2. Add the consumer key and consumer secret key in Strings.xml file
3. Create an oAuth service by providing consumer key and consumer secret key to request oAuth token for authorization.
4. Create an oAuth request with request method:
? For GET method:
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.
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.
Product response will have categories array:
While displaying subcategory with its products, filter this list based on current subcategory we are displaying.