# Installation Guide

## Quick Installation

### Method 1: WordPress Admin Upload (Recommended)

1. Download `wc-tier-and-package-prices.zip` from the releases
2. Log in to your WordPress admin dashboard
3. Navigate to **Plugins > Add New**
4. Click **Upload Plugin** button at the top
5. Click **Choose File** and select `wc-tier-and-package-prices.zip`
6. Click **Install Now**
7. After installation, click **Activate Plugin**
8. You're done! The plugin is now active.

### Method 2: Manual FTP Upload

1. Download `wc-tier-and-package-prices.zip`
2. Extract the ZIP file to get the `wc-tier-and-package-prices` folder
3. Connect to your server via FTP
4. Upload the entire `wc-tier-and-package-prices` folder to `/wp-content/plugins/`
5. Go to your WordPress admin dashboard
6. Navigate to **Plugins**
7. Find "WooCommerce Tier and Package Prices" and click **Activate**

### Method 3: WP-CLI

If you have WP-CLI installed:

```bash
wp plugin install wc-tier-and-package-prices.zip --activate
```

## Post-Installation Setup

### 1. Verify Installation

After activation, you should see:
- A new menu item: **WooCommerce > Tier & Package Prices**
- No error messages
- Plugin listed in **Plugins** page

### 2. Configure Global Settings

1. Go to **WooCommerce > Tier & Package Prices**
2. Configure the following options:
   - **Enable Tier Pricing**: ✓ (checked)
   - **Enable Package Pricing**: ✓ (checked)
   - **Display Pricing Table**: ✓ (checked)
   - **Display Position**: Choose where to show pricing tables
     - Before Add to Cart (recommended)
     - After Add to Cart
     - After Price
3. Click **Save Changes**

### 3. Configure Your First Product

1. Go to **Products** and edit any product (or create new one)
2. Scroll to **Product data** panel
3. Click the **General** tab
4. Scroll down to find the pricing sections

#### Add Tier Pricing (Volume Discounts)

1. Click **Add Tier** button
2. Example configuration:
   - Min Quantity: `10`, Price: `9.50`
   - Min Quantity: `25`, Price: `8.50`
   - Min Quantity: `50`, Price: `7.50`
3. Click **Update** to save

#### Add Package Pricing (Fixed Packages)

1. Click **Add Package** button
2. Example configuration:
   - Quantity: `12`, Price: `99.00`, Label: "Dozen Pack"
   - Quantity: `24`, Price: `180.00`, Label: "Double Pack"
3. Click **Update** to save

### 4. Test on Frontend

1. Visit your product page on the frontend
2. You should see:
   - Pricing table showing tiers and/or packages
   - Price updates when changing quantity
   - Package selection buttons (if packages configured)
3. Add to cart and verify correct pricing

## Requirements Check

Before installation, verify:

- ✓ WordPress 6.0 or higher (tested up to 6.9.x)
- ✓ WooCommerce 8.0 or higher (tested up to 10.x) installed and activated
- ✓ PHP 7.4 or higher
- ✓ Write permissions in `/wp-content/plugins/` directory

## Troubleshooting

### Plugin Won't Activate

**Error: "WooCommerce is required"**
- Solution: Install and activate WooCommerce first

**Error: "Parse error" or "Syntax error"**
- Solution: Your PHP version is too old. Upgrade to PHP 7.4 or higher

### Pricing Tables Not Showing

1. Check global settings are enabled (**WooCommerce > Tier & Package Prices**)
2. Verify you added tiers/packages to the specific product
3. Clear browser cache and reload the page
4. Check theme compatibility (try default WordPress theme)

### Prices Not Calculating Correctly

1. Make sure tiers are sorted by minimum quantity (plugin does this automatically)
2. Verify package quantities exactly match what customer selects
3. Clear WooCommerce caches (**WooCommerce > Status > Tools > Clear template cache**)

### Styling Issues

1. Clear browser cache
2. Check if theme has conflicting CSS
3. Try adding custom CSS in **Appearance > Customize > Additional CSS**

## Uninstallation

To completely remove the plugin:

1. Go to **Plugins** page
2. Deactivate "WooCommerce Tier and Package Prices"
3. Click **Delete**
4. Confirm deletion

**Note:** Product meta data (tiers and packages) will be preserved in database even after uninstallation. If you reinstall, your configurations will still be there.

To completely remove all data:
1. Before uninstalling, remove all tiers and packages from products
2. Then proceed with uninstallation

## File Structure After Installation

Your WordPress installation should have:

```
wp-content/
└── plugins/
    └── wc-tier-and-package-prices/
        ├── wc-tier-and-package-prices.php  (main file)
        ├── README.md
        ├── INSTALLATION.md
        ├── USAGE_EXAMPLES.md
        ├── includes/
        │   ├── class-wc-tpp-admin.php
        │   ├── class-wc-tpp-settings.php
        │   ├── class-wc-tpp-cart.php
        │   ├── class-wc-tpp-frontend.php
        │   ├── class-wc-tpp-product-meta.php
        │   └── class-wc-tpp-template-loader.php
        ├── templates/
        │   ├── admin/
        │   │   ├── tier-row.twig
        │   │   └── package-row.twig
        │   └── frontend/
        │       ├── pricing-table.twig
        │       ├── tier-pricing-table.twig
        │       └── package-pricing-display.twig
        ├── assets/
        │   ├── css/
        │   │   ├── admin.css
        │   │   └── frontend.css
        │   └── js/
        │       ├── admin.js
        │       └── frontend.js
        ├── languages/
        │   ├── wc-tier-package-prices.pot
        │   ├── wc-tier-package-prices-de_DE.po
        │   ├── wc-tier-package-prices-de_DE.mo
        │   ├── wc-tier-package-prices-de_CH_informal.po
        │   └── wc-tier-package-prices-de_CH_informal.mo
        └── vendor/
            └── (Twig and dependencies)
```

## Getting Help

If you encounter issues:

1. Check this installation guide
2. Review the [README.md](README.md) for feature documentation
3. Review [USAGE_EXAMPLES.md](USAGE_EXAMPLES.md) for configuration examples
4. Check WordPress error logs
5. Enable WP_DEBUG to see detailed errors

## Next Steps

After successful installation:

1. Read [USAGE_EXAMPLES.md](USAGE_EXAMPLES.md) for practical examples
2. Configure tier pricing on your products
3. Test the complete checkout flow
4. Customize display settings to match your theme
5. Consider creating package deals for popular quantities

Enjoy your new tier and package pricing capabilities!
