# Plugin Installation & Testing Guide

## Installation Steps

1. **Navigate to your WordPress plugins directory:**
   ```bash
   cd /path/to/wordpress/wp-content/plugins/
   ```

2. **The plugin is ready at:**
   ```
   /Volumes/Data/Work/Development/Doozy/src/doozy-order-protection/
   ```

3. **Create a symbolic link (recommended for development):**
   ```bash
   ln -s /Volumes/Data/Work/Development/Doozy/src/doozy-order-protection doozy-order-protection
   ```

   **OR copy the plugin folder:**
   ```bash
   cp -r /Volumes/Data/Work/Development/Doozy/src/doozy-order-protection /path/to/wordpress/wp-content/plugins/
   ```

4. **Activate in WordPress:**
   - Go to WordPress Admin → Plugins
   - Find "Doozy Order Protection"
   - Click "Activate"

## Configuration

1. After activation, go to **Doozy Protection** in the WordPress admin menu
2. Configure your settings:
   - Enable/disable protection
   - Set protection label (default: "Doozy Order Protection")
   - Set protection fee (default: $2.99)
   - Choose if checkbox is checked by default

## Testing

### Test on Cart Page
1. Add a product to cart
2. Go to cart page
3. Look for the protection checkbox above order total
4. Check/uncheck to see fee added/removed
5. Cart should update automatically via AJAX

### Test on Checkout Page
1. Proceed to checkout
2. Look for the protection checkbox in order review
3. Check/uncheck to see fee added/removed
4. Complete a test order with protection enabled
5. Verify fee is included in order total

### Test in Admin
1. Go to WooCommerce → Orders
2. Open the test order
3. Look for "Order Protection" section showing:
   - Protection Enabled: Yes
   - Protection Fee: $2.99

### Test Block Checkout (if using WooCommerce blocks)
1. Make sure you're using WooCommerce block-based checkout
2. Checkbox should appear in the order summary area
3. Functionality should work the same as classic checkout

## Troubleshooting

### Plugin doesn't activate
- **Error:** "Doozy Order Protection requires WooCommerce..."
- **Solution:** Install and activate WooCommerce plugin first

### Checkbox doesn't appear
- **Check:** Is protection enabled in settings?
- **Check:** Are you viewing cart or checkout page?
- **Check:** Browser console for JavaScript errors
- **Check:** Clear WordPress and browser cache

### Fee not calculating
- **Check:** Browser console for AJAX errors
- **Check:** WooCommerce → Status → Logs for PHP errors
- **Check:** Settings have a valid fee amount

### Styling issues
- **Solution:** The plugin includes responsive CSS
- **Custom CSS:** Can be added to override default styles
- **Main wrapper:** `.doozy-order-protection-wrapper`

## File Structure

```
doozy-order-protection/
├── doozy-order-protection.php      # Main plugin file
├── uninstall.php                   # Cleanup on uninstall
├── README.md                       # Full documentation
├── readme.txt                      # WordPress.org format
├── index.php                       # Security file
│
├── admin/                          # Admin area
│   ├── class-doozy-order-protection-admin.php
│   ├── css/
│   │   └── doozy-order-protection-admin.css
│   ├── js/
│   │   └── doozy-order-protection-admin.js
│   └── index.php
│
├── includes/                       # Core classes
│   ├── class-doozy-order-protection.php         # Main class
│   ├── class-doozy-order-protection-loader.php  # Hook loader
│   ├── class-doozy-order-protection-woocommerce.php  # WooCommerce integration
│   └── index.php
│
├── public/                         # Frontend
│   ├── class-doozy-order-protection-public.php
│   ├── css/
│   │   └── doozy-order-protection-public.css
│   ├── js/
│   │   └── doozy-order-protection-public.js
│   └── index.php
│
└── languages/                      # Translation files
    └── doozy-order-protection.pot
```

## Next Steps for Production

### Future Enhancements (Optional)
- Add analytics/tracking for protection adoption rate
- Integration with actual insurance provider API
- Custom protection amounts based on order value
- Email notifications when protection is added
- Admin reports for protection revenue
- Multi-currency support refinement
- Protection claim submission form
- Automatic claim processing workflow

### Before Going Live
1. Test thoroughly on staging site
2. Test with different themes
3. Test with WooCommerce blocks
4. Verify mobile responsiveness
5. Check translation strings
6. Review security (nonce verification, sanitization)
7. Performance testing with large carts
8. Cross-browser testing

## Support Resources

- WordPress Coding Standards: https://developer.wordpress.org/coding-standards/
- WooCommerce Documentation: https://woocommerce.com/documentation/
- WooCommerce Hooks: https://woocommerce.github.io/code-reference/hooks/hooks.html

