| 1 |
# SuperFrete WooCommerce Development Environment |
| 2 |
|
| 3 |
This is a complete development environment for the SuperFrete WooCommerce plugin using Nix and Docker. |
| 4 |
|
| 5 |
## Prerequisites |
| 6 |
|
| 7 |
- [](https://nixos.org/download.htmlNix package manager](https://nixos.org/download.html](https://nixos.org/download.html) |
| 8 |
- [](https://direnv.net/docs/installation.htmldirenv](https://direnv.net/docs/installation.html](https://direnv.net/docs/installation.html) |
| 9 |
- [](https://docs.docker.com/get-docker/Docker](https://docs.docker.com/get-docker/](https://docs.docker.com/get-docker/) |
| 10 |
- [](https://docs.docker.com/compose/install/Docker Compose](https://docs.docker.com/compose/install/](https://docs.docker.com/compose/install/) |
| 11 |
|
| 12 |
## Getting Started |
| 13 |
|
| 14 |
1. Allow direnv to use the Nix flake: |
| 15 |
|
| 16 |
```bash |
| 17 |
direnv allow |
| 18 |
``` |
| 19 |
|
| 20 |
2. Start the Docker containers: |
| 21 |
|
| 22 |
```bash |
| 23 |
docker-compose up -d |
| 24 |
``` |
| 25 |
|
| 26 |
3. The environment will be set up automatically, including: |
| 27 |
- WordPress installation |
| 28 |
- WooCommerce plugin activation |
| 29 |
- SuperFrete plugin activation |
| 30 |
- Basic store configuration with Brazilian settings |
| 31 |
|
| 32 |
4. Access the environment: |
| 33 |
- WordPress site: http://localhost:8087 |
| 34 |
- Admin login: admin/admin |
| 35 |
- phpMyAdmin: http://localhost:8086 (server: db, username: root, password: rootpassword) |
| 36 |
|
| 37 |
## Development Workflow |
| 38 |
|
| 39 |
The current directory is mounted as the SuperFrete plugin directory in WordPress. Any changes you make to the plugin files will be immediately reflected in the WordPress environment. |
| 40 |
|
| 41 |
## WP-CLI Commands |
| 42 |
|
| 43 |
You can run WP-CLI commands with: |
| 44 |
|
| 45 |
```bash |
| 46 |
docker-compose run --rm wp-cli wp <command> |
| 47 |
``` |
| 48 |
|
| 49 |
For example, to list all plugins: |
| 50 |
|
| 51 |
```bash |
| 52 |
docker-compose run --rm wp-cli wp plugin list |
| 53 |
``` |
| 54 |
|
| 55 |
## Database Management |
| 56 |
|
| 57 |
Use phpMyAdmin at http://localhost:8086 or connect directly with: |
| 58 |
|
| 59 |
```bash |
| 60 |
docker-compose exec db mysql -u wordpress -pwordpress wordpress |
| 61 |
``` |
| 62 |
|
| 63 |
## Troubleshooting |
| 64 |
|
| 65 |
- If WordPress can't connect to the database, wait a few moments for MySQL to initialize fully. |
| 66 |
- If plugins don't activate automatically, activate them manually through the WordPress admin. |
| 67 |
- If you encounter architecture compatibility issues (ARM64/Apple Silicon): |
| 68 |
- The docker-compose.yml uses ARM64-compatible images |
| 69 |
- If you still have issues, you may need to use `--platform linux/amd64` for specific services |
| 70 |
- To reset the environment completely: |
| 71 |
```bash |
| 72 |
docker-compose down -v |
| 73 |
docker-compose up -d |
| 74 |
``` |
| 75 |
|
| 76 |
## Testing the SuperFrete Plugin |
| 77 |
|
| 78 |
1. Log in to the WordPress admin |
| 79 |
2. Go to WooCommerce -> Settings -> Shipping -> Shipping Options |
| 80 |
3. Configure your SuperFrete API credentials |
| 81 |
4. Create a test product |
| 82 |
5. Test the shipping calculator on the product page |
| 83 |
|