Woocommerce API
To create WooCommerce app (single vendor, WCFM, or Dokan) or Manager app, let’s install our free MStore API and some plugins to your WooCommerce website so that the app can sync with your data:
1. Website Integration
Install the MStore API and WooCommerce plugins on your website.
MStore API is required for supporting RestAPI to connect the app, support Payment, SMS Login, Facebook Login, etc.
If your website is using WCFM multivendor plugin, please also install these plugins:
If your website is using Dokan multivendor plugin, be sure to also install this Dokan plugin.
If you have a fresh WordPress website without real data, you can import our demo data with the following 4 easy steps and you are good to go.
- Step 1: Download Options Importer plugin file, then
upload and active
this plugin on your website (you can find it on the Internet but we recommend using the plugin we provided as we have already modified it to suit the requirement of our Apps) - Step 2: Download both Demo Options and Demo Products (If you wish to use your own products, you can skip the Demo Products file), then go to Tools -> Import -> Run Importer(Options) and
upload
the Demo Options file.- Switch to
Specific Options
and pressSelect Defaults
and make sure all of the WooCommerce options are selected. - If you have already set up the WooCommerce settings and you don't want any new changes to be applied to your configuration, uncheck the option
Override existing options
. Otherwise, just leave it like that if your website is newly fresh or you are not sure about your WooCommerce Settings. - If you have error during importing the Json file, try to change the json file extension from ".json" to ".json.txt"
- Switch to
- Step 3:
Import
the Demo Products using WooCommerce importer feature. Again, this step is optional. - Step 4:
Generate
the WooCommerce REST API key and save them to your private file for later usage. Then, go to Legacy API and enable the Enable the legacy REST API. Make sure to use the Permission as Read to protect your side data as Readonly.
Checking the Rest API configuration:
- Access your website using the Rest API endpoint (your-domain/wp-json/wc/v3), for example: https://wordpress.inspireui.com/wp-json/wc/v3
- If there is a list of ordered endpoints, that means it works.
- If not, have a look at this guide: Setting up Rest API.
That's all. You can remove the Options Importer plugin and remember to use the Regenerate Thumbnails plugin when you are developing on real products.
2. Setup the Regenerate Image
In case your products do not display, missing Image, or a quite slow Image Loading issue, we can fix them by installing the Regenerate Image plugin.
Firstly, go to Setting -> Media, configure your preferred image sizes. This is our recommended settings - https://tppr.me/IbRvL
Secondly, go to Tools -> Regenerate Thumbnails and select the button Regenerate Thumbnails For All xx Attachements
and wait for the process to complete.
Thirdly, to check the images if they are correctly generated, go to Media and select any image files, then choose Regenerate Thumbnails
button. Now you can see if the image is created with format xxx-small
or xxx-medium
or xxx-large
files.
That’s all 😊