😍A React WooCommerce Project Example With REST API

Example 1

Đây là bản ban đầu dùng để nghiên cứu
https://github.com/imranhsayed/nextjs-woocommerce-restapi

Quan trọng là cấu hình để chạy

.env

#Backend WordPress Site URL.
NEXT_PUBLIC_WORDPRESS_SITE_URL=https://wpclidemo.dev
#Frontend Next.js Site URL
NEXT_PUBLIC_SITE_URL=http://localhost:3000
#Stripe env variables.
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_xxx
STRIPE_SECRET_KEY=sk_test_xxx
STRIPE_WEBHOOK_ENDPOINT_SECRET=whsec_xxxx
## WooCommerce Consumer Key and secret.
WC_CONSUMER_KEY=ck_xx
WC_CONSUMER_SECRET=cs_xx
NEXT_PUBLIC_API_MOCKING=disabled
NODE_TLS_REJECT_UNAUTHORIZED=0

Hoặc

Chú ý: Trong plugin headless-cms headless-cms\inc\classes\api\class-get-posts.php thiếu 1 trường cho blog đó là slug

wp-content\themes\storefront\functions.php

wp-content\plugins\headless-cms\inc\classes\api\class-get-posts.php

C:\xampp82\htdocs\wpclidemo\wp-content\plugins

Đây là bản đã chỉnh sửa thêm slug cho bài viết ở blog lấy về là dùng

Example 2

Last updated