├── .env-example ├── .gitignore ├── README.md ├── demos ├── Checkout-page.gif ├── home-demo.gif ├── order-received-demo.gif ├── paypal-payment-demo.gif └── stripe-demo.gif ├── next.config.js ├── package-lock.json ├── package.json ├── pages ├── _app.js ├── api │ ├── create-order.js │ ├── get-stripe-session.js │ ├── stripe-web-hook.js │ └── stripe │ │ └── [...nextstripe].js ├── cart.js ├── categories.js ├── category │ └── [slug].js ├── checkout.js ├── index.js ├── product │ └── [slug].js └── thank-you.js ├── postcss.config.js ├── public └── cart-spinner.gif ├── src ├── components │ ├── ApolloClient.js │ ├── Footer.js │ ├── Header.js │ ├── Layout.js │ ├── Nav.js │ ├── Product.js │ ├── cart │ │ ├── AddToCartButton.js │ │ ├── CartIcon.js │ │ └── cart-page │ │ │ ├── CartItem.js │ │ │ └── CartItemsContainer.js │ ├── category │ │ └── category-block │ │ │ ├── ParentCategoriesBlock.js │ │ │ └── ParentCategoryBlock.js │ ├── checkout │ │ ├── Address.js │ │ ├── CheckoutCartItem.js │ │ ├── CheckoutForm.js │ │ ├── CountrySelection.js │ │ ├── Error.js │ │ ├── OrderSuccess.js │ │ ├── PaymentModes.js │ │ ├── StatesSelection.js │ │ ├── YourOrder.js │ │ └── form-elements │ │ │ ├── Abbr.js │ │ │ ├── CheckboxField.js │ │ │ └── InputField.js │ ├── context │ │ └── AppContext.js │ ├── home │ │ └── hero-carousel │ │ │ └── index.js │ ├── icons │ │ ├── ArrowDown.js │ │ ├── Cross.js │ │ ├── Facebook.js │ │ ├── Instagram.js │ │ ├── Loading.js │ │ ├── ShoppingCart.js │ │ ├── Twitter.js │ │ ├── Youtube.js │ │ ├── index.js │ │ └── svgs │ │ │ ├── arrow-down.svg │ │ │ ├── cross.svg │ │ │ ├── facebook.svg │ │ │ ├── instagram.svg │ │ │ ├── shopping-cart.svg │ │ │ ├── twitter.svg │ │ │ └── youtube.svg │ └── single-product │ │ ├── gallery-carousel │ │ └── index.js │ │ └── price │ │ └── index.js ├── constants │ └── urls.js ├── functions.js ├── image │ └── index.js ├── img │ └── girls.jpg ├── mutations │ ├── add-to-cart.js │ ├── checkout.js │ ├── clear-cart.js │ └── update-cart.js ├── queries │ ├── get-cart.js │ ├── get-categories.js │ ├── get-countries.js │ ├── get-order.js │ ├── get-states.js │ ├── product-and-categories.js │ ├── product-by-category.js │ └── product-by-slug.js ├── styles │ ├── main.scss │ └── style.scss ├── utils │ ├── cart.js │ ├── checkout.js │ └── order.js └── validator │ ├── checkout.js │ └── isEmpty.js ├── tailwind.config.js ├── wordpress └── plugins │ ├── headless-cms.zip │ ├── wp-graphql-woocommerce.zip │ └── wp-graphql.zip └── yarn.lock /.env-example: -------------------------------------------------------------------------------- 1 | NEXT_PUBLIC_WORDPRESS_URL=https://example.com 2 | 3 | NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_xxx 4 | STRIPE_SECRET_KEY=sk_test_xxx 5 | 6 | STRIPE_WEBHOOK_ENDPOINT_SECRET=whsec_xxxx 7 | 8 | WC_CONSUMER_KEY=ck_xxx 9 | WC_CONSUMER_SECRET=cs_xxx 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | *.log 3 | npm-debug.log 4 | yarn-error.log 5 | .DS_Store 6 | build/ 7 | node_modules/ 8 | dist/ 9 | .cache 10 | .next 11 | .env 12 | .now 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [WooCommerce Nextjs React Theme](https://woo-next-imranhsayed.vercel.app/) :rocket: 2 | [](https://www.repostatus.org/#active) 3 |  4 |  5 |  6 |  7 | 8 | > * This is a React WooCommerce theme, built with Next JS, Webpack, Babel, Node, GraphQl 9 | 10 | 📹 [Full Course Video Tutorial](https://codeytek.com/course/woocommerce-with-react-course/) 11 | 12 | ## Important Note ⭐: 13 | The code for the Video Tutorial is in the branch [youtube-course](https://github.com/imranhsayed/woo-next/tree/youtube-course) 14 | However, since there is continuous contribution and updates to this project. The 'master' 15 | branch is upto date with those changes. You can also refer to the PR notes for changes. 16 | 17 | ## Demo Desktop :video_camera: 18 | 19 |  20 | 21 | ## Live Demo: 22 | 23 | [Live Demo Site](https://woo-next-imranhsayed.vercel.app/) 24 | 25 | ## Checkout Page Demo 26 |  27 | 28 | ## Payment Demo ( Paypal example ) 29 |  30 | 31 | ## Order Received Demo 32 |  33 | 34 | ## Stripe Checkout 35 | [Stripe Demo Video](https://youtu.be/i75_Vtx-CnA) 36 |  37 | 38 | # Features: 39 | 40 | 1. WooCommerce Store in React( contains: Products Page, Single Product Page, AddToCart, CartPage and Checkout Page with country selection ). 41 | 2. SSR 42 | 3. SEO friendly 43 | 4. Automatic Code Splitting 44 | 5. Hot Reloading 45 | 6. Prefetching 46 | 8. Incremental Static (Re)generation ( Next.js 10 support ) 47 | 9. GraphQL with Apollo Client 48 | 10. Tailwindcss 49 | 11. Stripe Checkout ( with Stripe Session and Stripe webhook) 50 | 51 | ## Getting Started :rocket: 52 | 53 | These instructions will get you a copy of the project up and running on your local machine for development purposes. 54 | 55 | ### Prerequisites :page_facing_up: 56 | 57 | ### Installing :wrench: 58 | 59 | 1. Clone this repo using terminal `git clone git@github.com:imranhsayed/woo-next` 60 | 2. `cd woo-next` 61 | 3. `yarn install` 62 | 63 | ## Add GraphQl support for WordPress 64 | 65 | 1. Download and activate the following plugins , in your WordPress plugin directory: 66 | 67 | * [wp-graphql](https://github.com/imranhsayed/woo-next/tree/master/wordpress/plugins) Exposes graphql for WordPress ( **Tested with v-1.3.8** of this plugin ) 68 | * [wp-graphql-woocommerce](https://github.com/imranhsayed/woo-next/tree/master/wordpress/plugins) Adds Woocommerce functionality to a WPGraphQL schema ( **Tested with v-0.8.1** of this plugin ) 69 | * [headless-cms](https://github.com/imranhsayed/woo-next/tree/master/wordpress/plugins) Extends WPGraphQL Schema ( **Tested with v-1.8.0** of this plugin ) 70 | 71 | * Make sure Woocommerce plugin is also installed in your WordPress site. You can also import default wooCommerce products that come with wooCommerce Plugin for development ( if you don't have any products in your WordPress install ) `WP Dashboard > Tools > Import > WooCommerce products(CSV)`: The WooCommerce default products csv file is available at `wp-content/plugins/woocommerce/sample-data/sample_products.csv` 72 | 73 | ## Hero Carousel. 74 | To use Hero carousel, create a category called 'offers' from WordPress Dashboard > Products > Categories. 75 | Now create and assign as many child categories to this parent 'offers' category with name, description and image. 76 | These Child categories data will automatically be used to create hero carousel on the frontend. 77 | 78 | 79 | ## Configuration(for GraphQL implementation) :wrench: 80 | 81 | * _Note_ Below is for GraphQL implementation , for REST API check [feature/rest-api](https://github.com/imranhsayed/woo-next/tree/feature/rest-api) branch 82 | 83 | 1. (Required) Create a `.env` file taking reference from `.env-example` and update your WordPressSite URL. 84 | - `NEXT_PUBLIC_WORDPRESS_URL=https://example.com` 85 | 86 | ## Branch details 87 | 88 | 1. [feature/rest-api](https://github.com/imranhsayed/woo-next/tree/feature/rest-api) Contains REST API Implementation. 89 | 90 | 2. The `master` branch has the GraphQL implementation. 91 | 92 | ## Common Commands :computer: 93 | 94 | * `dev` Runs server in development mode 95 | 96 | ## Code Contributors ✰ 97 | 98 | Thanks to all the people who contributed to the code of this project 🤝 99 | 100 |
Your payment is successful and your order details are:
44 |Name | 48 |Details | 49 |
---|---|
Order# | 54 |{sessionData?.metadata?.orderId} | 55 |
{sessionData?.customer_email} | 59 |
Clearing...
: '' } 121 | { updateCartProcessing ?Updating...
: null } 122 |129 | | 130 | | Product | 131 |Price | 132 |Quantity | 133 |Total | 134 |
---|
Subtotal | 160 |{ ( 'string' !== typeof cart.totalProductsPrice ) ? cart.totalProductsPrice.toFixed(2) : cart.totalProductsPrice } | 161 |
Total | 164 |{ ( 'string' !== typeof cart.totalProductsPrice ) ? cart.totalProductsPrice.toFixed(2) : cart.totalProductsPrice } | 165 |
Status : { responseData.order.status }
19 |15 | | Product | 16 |Total | 17 |
---|---|---|
28 | | Subtotal | 29 |{ cart.totalProductsPrice } | 30 |
33 | | Total | 34 |{ cart.totalProductsPrice } | 35 |
{heroCarousel[activeIndex]?.description}
85 | 86 | + Explore 87 | 88 |