# CourseStorm for WordPress - Member Pricing Support

This document outlines the member pricing functionality that has been added to the CourseStorm for WordPress plugin, similar to the implementation in the main CourseStorm application.

## Overview

The member pricing feature allows sites with membership functionality to display both regular pricing and discounted member pricing throughout the course display templates.

## API Integration
### Member Price Data
When membership is activated, the API will include `member_price` in course data, which gets automatically synced as post meta during the synchronization process.

## Implementation Details

### Template Elements

1. **`templates/elements/price-display.php`**
   - Standardized price formatting template
   - Handles currency display, cents formatting, and prefix support
   - Replaces inline price formatting code

2. **`templates/elements/membership-price.php`**
   - Comprehensive member pricing display logic
   - Shows both regular and member pricing when membership is enabled
   - Handles proration and session-based pricing
   - Displays crossed-out regular price with highlighted member price

### Updated Templates
Templates that currently show member pricing:

- **`templates/single.php`** - Single course detail page
- **`templates/archive.php`** - Course archive/listing page  
- **`templating.php`** - Search results content

### Member Price Usage
Member pricing is implemented directly in templates using:

```php
// Get member price from post meta
$member_price = get_post_meta(get_the_ID(), 'member_price', true);

// Display pricing with member support
if (!empty($member_price) && $member_price !== '') {
    CourseStorm_Templates::element('membership-price', [
        'price' => $price,
        'member_price' => $member_price,
        'course_sessions_enabled' => $site_supports_sessions
    ]); 
} else {
    // Display regular pricing
    echo esc_html($price_formatted);
}
```

## Template Element Parameters

### `membership-price.php` Parameters:
- `$price`: Regular price (string or number)
- `$member_price`: Member price (string or number)  
- `$show_pricing_when_not_prorated`: boolean (default false)
- `$course_sessions_enabled`: boolean (default false)
- `$original_price`: Original price before proration (optional)

### `price-display.php` Parameters:
- `$price`: Price value (string or number)
- `$show_currency`: boolean (default true) - whether to show currency symbol
- `$prefix`: string (optional) - text to show before the price
