37
loading...
This website collects cookies to deliver better user experience
Download and Install the Custom Rest API plugin from this link.
Install woocommerce and enable Rest API in woocommerce plugin .
This will generate an API key, copy it to env. local
file as shown below
NEXT_PUBLIC_WP="http://localhost/wordpress/wp-json"
NEXT_PUBLIC_WOO_COM="http://localhost/wordpress"
#woocommerce API keys
NEXT_PUBLIC_CUSTOMER_KEY=WoocommerceCustomerKey
NEXT_CUSTOMER__SECRET_KEY=WoocommerceSecretKey
#stripe keys
NEXT_STRIPE_KEY=Stripe Secret Keys
NEXT_PUBLIC_STRIPE_KEY=Stripe Publishable key
Almost all the things which I am requesting from my custom API can be achieved through the current woocommerce package in next.js, but the woocommerce package also provides some unnecessary and sensitive data like the file link for digital products. This can lead to various securities issues, also the response time is reduced due to the population of unrequired data in every request.
Woocommerce Rest API is wonderful but it still not provide a way for us to calculate cart items
through the rest of API, maybe this will be added in the future I guess. I have created a route in my plugin that will provide the product details. you can learn more about this in my plugin documentation.
For checking the validity of coupons and orders ids of the customer for some securities purposes.