|
1 | | -# Nuxt 3 Minimal Starter |
| 1 | +[](https://app.codacy.com/gh/w3bdesign/nuxtjs-woocommerce?utm_source=github.com&utm_medium=referral&utm_content=w3bdesign/nuxtjs-woocommerce&utm_campaign=Badge_Grade) |
| 2 | +[](https://www.codefactor.io/repository/github/w3bdesign/nuxtjs-woocommerce) |
| 3 | +[](https://sonarcloud.io/dashboard?id=w3bdesign_nuxtjs-woocommerce) |
2 | 4 |
|
3 | | -Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more. |
| 5 | +# Nuxt 3 Ecommerce site with WooCommerce backend |
4 | 6 |
|
5 | | -## Setup |
| 7 | +<img src="https://user-images.githubusercontent.com/45217974/106988377-f129a080-676f-11eb-94b9-a44c86ea6c79.png" alt="Project screenshot" /> |
6 | 8 |
|
7 | | -Make sure to install the dependencies: |
| 9 | +## Table Of Contents (TOC) |
8 | 10 |
|
9 | | -```bash |
10 | | -# yarn |
11 | | -yarn install |
| 11 | +- [Features](#Features) |
| 12 | +- [Installation](#Installation) |
| 13 | +- [Troubleshooting](#Troubleshooting) |
| 14 | +- [TODO](#TODO) |
12 | 15 |
|
13 | | -# npm |
14 | | -npm install |
| 16 | +## Features |
15 | 17 |
|
16 | | -# pnpm |
17 | | -pnpm install |
18 | | -``` |
| 18 | +- Nuxt 3 |
| 19 | +- Tailwind CSS |
| 20 | +- Nuxt Apollo |
| 21 | +- Responsive design |
| 22 | +- Support for simple and variable products |
| 23 | +- CSS animations and transitions |
| 24 | +- Form handling and validation with Formkit, Vee Validate and Yup |
| 25 | +- Checkout process |
| 26 | +- Animated mobile menu |
19 | 27 |
|
20 | | -## Development Server |
| 28 | +## Installation |
21 | 29 |
|
22 | | -Start the development server on http://localhost:3000 |
| 30 | +1. Install and activate the following required plugins, in your WordPress plugin directory: |
23 | 31 |
|
24 | | -```bash |
25 | | -npm run dev |
26 | | -``` |
| 32 | +- [woocommerce](https://wordpress.org/plugins/woocommerce) Ecommerce for WordPress. |
| 33 | +- [wp-graphql](https://wordpress.org/plugins/wp-graphql) Exposes GraphQL for WordPress. |
| 34 | +- [wp-graphql-woocommerce](https://github.com/wp-graphql/wp-graphql-woocommerce) Adds WooCommerce functionality to a WPGraphQL schema. Currently only confirmed to be working with version 0.61 of this plugin. |
| 35 | +- [algolia-woo-indexer](https://github.com/w3bdesign/algolia-woo-indexer) Sends WooCommerce products to Algolia. Required for search to work. |
27 | 36 |
|
28 | | -## Production |
| 37 | +Optional plugin: |
29 | 38 |
|
30 | | -Build the application for production: |
| 39 | +- [headless-wordpress](https://github.com/w3bdesign/headless-wp) Disables the frontend so only the backend is accessible. |
| 40 | +- [wp-graphql-cors](https://github.com/funkhaus/wp-graphql-cors) Ensures that CORS works correctly. Remember to add the domain to the store under `Extend "Access-Control-Allow-Origin” header` |
31 | 41 |
|
32 | | -```bash |
33 | | -npm run build |
34 | | -``` |
| 42 | +The current release has been tested and is confirmed working with the following plugin versions: |
35 | 43 |
|
36 | | -Locally preview production build: |
| 44 | +- WordPress version 6.1.1 |
| 45 | +- WooCommerce version 7.1.0 |
| 46 | +- WP GraphQL version 1.5.0 |
| 47 | +- WooGraphQL version 0.6.2 |
37 | 48 |
|
38 | | -```bash |
39 | | -npm run preview |
40 | | -``` |
| 49 | +2. Make sure WooCommerce has some products already or import some sample products |
41 | 50 |
|
42 | | -Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information. |
| 51 | + The WooCommerce sample products CSV file is available at `wp-content/plugins/woocommerce/sample-data/sample_products.csv` or [Sample products](sample_products/) |
| 52 | + |
| 53 | + Import the products at `WP Dashboard > Tools > Import > WooCommerce products(CSV)` |
| 54 | + |
| 55 | +3. Clone or fork the repo and modify `.env` with the URL to the GraphQL endpoint (or set environment variables in the configuration UI for your deployment solution) |
| 56 | + |
| 57 | +4. Start the server with `npm run dev` |
| 58 | + |
| 59 | +5. Enable COD (Cash On Demand) payment method in WooCommerce |
| 60 | + |
| 61 | +6. Add a product to the cart |
| 62 | + |
| 63 | +7. Proceed to checkout |
| 64 | + |
| 65 | +8. Fill in your details and place the order |
| 66 | + |
| 67 | +## Troubleshooting |
| 68 | + |
| 69 | +### I am getting a cart undefined error or other GraphQL errors |
| 70 | + |
| 71 | +Check that you are using the 0.6.2 version of the [wp-graphql-woocommerce](https://github.com/wp-graphql/wp-graphql-woocommerce) plugin |
| 72 | + |
| 73 | +### The products page isn't loading |
| 74 | + |
| 75 | +Check the attributes of the products. Right now the application requires Size and Color. |
| 76 | + |
| 77 | +## TODO |
| 78 | + |
| 79 | +- Refactor and improve codebase with reusable components |
0 commit comments