Using Woocommerce as backend & ReactJS as frontend?
Asked Answered
S

2

7

Is it possible to use woocommerce as backend & ReactJS as frontend? I am new to creating online shops, and would like to write a frontend with ReactJS, but I am not sure what options there are for the backend.

I do know I can use Wordpress as a backend. Can I also install woocommerce and use it as a backend on top?

Selfimportant answered 17/1, 2018 at 17:29 Comment(0)
S
6

WooCommerce provides REST API which you can use to power your frontend. However for that you need to provide consumer key and consumer secret to your frontend, which is not a good idea security-wise, so it is ideal to create a API proxy and make the frontend communicate with the proxy which then routes the calls to the actual API using the key and secret.

Simarouba answered 1/9, 2018 at 7:15 Comment(0)
B
0

First of all you have to create API keys:

  1. To start using REST API, you first need to generate API keys.

  2. Go to WooCommerce > Settings > Advanced

  3. Go to the REST API tab and click Add key.

  4. Give the key a description for your own reference,

  5. Choose a user with access to orders etc.

  6. Give the key read/write permissions.

  7. Click Generate API key.

  8. Your keys will be shown

  9. Do not close this tab yet, the secret will be hidden if you try to view the key again.

You can use the following guides:

React + WordPress

woocommerce-rest-api

Maybe you need to allow the CORS too, use this guid

Finally better to use JWT-authentication in addition to API KEY.

Bassoon answered 11/2, 2020 at 7:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.