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
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.
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.
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.
4. Add key by providing details. And click on Generate API key button Consumer key and consumer secret keys will be generated
1. Add scribe library to android project in app/libs folder.
2. Add the consumer key and consumer secret key in Strings.xml file
? 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.