Woocommerce rest api + React dev + local ssl

This topic is talk about woocommerce and react integration.


Local environment with SSL



WordPress Setup

Setup a wordpress with woocommerce plugin, generate a self sign certificate store in project folder ssl.

React Library

You can find more information from github

yarn add @woocommerce/woocommerce-rest-api 

Modify package.json

"start": "HTTPS=true SSL_CRT_FILE=[path_to_your]/ssl/shirtstore.com.crt  SSL_KEY_FILE=[path_to_your]/ssl/shirtstore.com.key react-scripts start"

Call For API

const api = new WooCommerceRestApi({
    url: "https://localhost.com",
    consumerKey: "ck_xxxxxx",
    consumerSecret: "cs_xxxxxx",
    version: "wc/v3"

useMemo(() => {
        async function fetchData() {
            ap.iget("products/categories", {
                "parent": "0",
                "exclude": [15, 221]
            }).then((response) => {
            }).catch((error) => { });
}, []);
Woocommerce rest api + React dev + local ssl

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.