# Variable Products

Bizzwishlist supports WooCommerce variable products, allowing customers to save specific product variations (e.g., a particular size and color combination) in their wishlist.

## Overview

WooCommerce variable products have multiple variations (e.g., a T-shirt in different sizes and colors). Bizzwishlist can handle these in two ways, controlled by an admin setting.

## Configuring Variation Wishlist Support

1. Go to **Bizzwishlist > Settings**.
2. Find the **"Variable Product"** section.
3. Set **"Allow Variation Wishlist"** to **Yes** or **No**.
4. Save the settings.

> **Screenshot placeholder:** *Admin settings showing the variation wishlist toggle.*

## Behavior When Enabled (Default)

When **"Allow Variation Wishlist"** is set to **Yes**:

- Customers can add **individual variations** to the wishlist.
- Each variation is stored separately with its `variation_id`.
- The wishlist page shows the **specific variation details** (e.g., "Size: Large, Color: Red").
- Customers can have multiple variations of the same product in their wishlist.
- Adding to cart from the wishlist adds the exact variation selected.

**Example:**
A customer adds "Blue T-Shirt - Size M" and "Blue T-Shirt - Size L" as two separate wishlist entries.

> **Screenshot placeholder:** *Wishlist page showing two variations of the same product as separate entries.*

## Behavior When Disabled

When **"Allow Variation Wishlist"** is set to **No**:

- Only the **parent product** is added to the wishlist (no specific variation).
- The `variation_id` is stored as `0` in the database.
- The wishlist page shows the parent product with a **variation selector**.
- Customers must select their desired variation before adding to cart from the wishlist.

**Example:**
A customer adds "Blue T-Shirt" to the wishlist. On the wishlist page, they see a dropdown to pick Size and Color before adding to cart.

## How It Works on Product Pages

### Single Product Page

On a variable product page with variation dropdowns:

- **With variation tracking:** The wishlist button adds the currently selected variation. If no variation is selected, it prompts the user to choose one.
- **Without variation tracking:** The wishlist button adds the parent product regardless of variation selection.

### Shop Loop Page

On the shop/catalog page:

- Variable products display the wishlist button.
- Since the loop does not show variation selectors, the parent product is typically added.
- Customers can manage variations on the full wishlist page.

## Database Storage

Wishlist entries for variable products are stored with both fields:

| Field | Value |
|-------|-------|
| `product_id` | Parent product ID |
| `variation_id` | Specific variation ID (or `0` if tracking is disabled) |

The unique constraint ensures a customer cannot add the same product + variation combination twice.
