# Bizzmudra - Multi Currency Switcher

A powerful, lightweight multi-currency switcher plugin for WooCommerce that allows customers to view prices in their preferred currency.

## Features

- 🌍 Add multiple currencies to your WooCommerce store
- 💱 Manually set and manage exchange rates
- 🔄 Simple and intuitive currency switcher
- 🛒 Automatic price conversion across shop, cart, and checkout
- 📱 Responsive and mobile-friendly
- ⚡ Lightweight and performance-optimized
- 🎨 Compatible with all WooCommerce themes
- 🧩 Widget and shortcode support
- 📍 **Flexible display positions** (Shop Page, Footer, Floating Left/Right)
- 🎯 **Product page control** - Show/hide on individual product pages
- 🔧 **Fully customizable** - Complete control over switcher placement
- ✅ **Currency selection** - Choose which currencies to display on frontend
- ⬆️ **Smart dropdown** - Opens upward in footer to stay visible

## Installation

1. Upload the plugin files to `/wp-content/plugins/bizzmudra`
2. Activate the plugin through the WordPress admin panel
3. Navigate to **Multi Currency** in the admin menu
4. Add currencies and set exchange rates
5. Display the switcher using `[bizzmudra_currency_switcher]` shortcode or widget

## Usage

### Display Settings

Configure where the currency switcher appears:

**Multi Currency → General Settings**

**Display Position Options:**
- **None** - Use only shortcode or widget
- **Shop Page Start** - Automatically display at the top of shop pages
- **Footer** - Show in the website footer (dropdown opens upward for better visibility)
- **Floating Left** - Fixed position on the left side (stays visible while scrolling)
- **Floating Right** - Fixed position on the right side (stays visible while scrolling)

**Product Page Option:**
- ☑ **Display below product title** - Show currency switcher on individual product pages

**Currency Selection:**
- ☑ Check currencies you want to display on frontend
- ☐ Uncheck currencies to hide them from customers
- Only enabled currencies appear in the currency switcher dropdown

### Shortcode

Add the currency switcher anywhere using:
```
[bizzmudra_currency_switcher]
```

### Widget

Go to **Appearance → Widgets** and add the "Currency Switcher" widget to any widget area.

## Documentation

Documentation is available in the `docs/` folder (in Bengali):

- **[Usage Guide](docs/usage/)** - How to use the plugin features
- **[New Updates](docs/new-updates/)** - Architecture changes and update details
- **[Future Plans](docs/future-plans.md)** - Upcoming features and roadmap
- **[Installation Guide](docs/installation.md)** - Step-by-step installation instructions
- **[Developer Guide](docs/developer-guide.md)** - Technical documentation and API reference
- **[Hooks & Filters](docs/hooks-filters.md)** - Complete hooks and filters reference
- **[Display Settings](docs/display-settings.md)** - Guide to display position controls
- **[Changelog](docs/changelog.md)** - Detailed changelog of all changes

## Requirements

- WordPress 6.2 or higher
- WooCommerce 5.0 or higher
- PHP 8.0 or higher

## For Developers

### File Structure

```
bizzmudra/
├── bizzmudra.php           # Main loader (constants + autoloader + Plugin init)
├── includes/                    # Source code (namespaced)
│   ├── Core/               # Plugin, Autoloader, Activator, Deactivator
│   ├── Services/           # CurrencyData, ExchangeRate, PriceConverter
│   ├── Frontend/           # Switcher, PublicHandler, Widget
│   ├── Admin/              # AdminHandler
│   └── Helpers/            # Global utility functions
├── admin/                  # Admin settings
│   ├── framework-loader.php    # Options framework configuration
│   └── options-framework/      # Shared BizzPlugin Options Framework (DO NOT MODIFY)
├── assets/                 # JavaScript and CSS files
│   ├── js/                 # admin.js, public.js
│   └── css/                # admin.css, public.css
├── includes/               # Data files
│   └── exchange-rate.json  # Default exchange rates
├── languages/              # Translation files
├── docs/                   # Documentation (Bengali)
└── readme.txt              # WordPress.org readme
```

### Namespace & Key Classes

All classes use the `Bizzmudra\` namespace prefix:

| Class | Purpose |
|-------|---------|
| `Bizzmudra\Core\Plugin` | Main orchestrator - initializes all services and hooks |
| `Bizzmudra\Core\Autoloader` | PSR-4 style class autoloader |
| `Bizzmudra\Core\Activator` | Plugin activation logic |
| `Bizzmudra\Core\Deactivator` | Plugin deactivation logic |
| `Bizzmudra\Services\CurrencyData` | Currency data management (CRUD, settings) |
| `Bizzmudra\Services\ExchangeRate` | Exchange rate handling (JSON, transients, AJAX) |
| `Bizzmudra\Services\PriceConverter` | WooCommerce price conversion filters |
| `Bizzmudra\Frontend\Switcher` | Shortcode and AJAX currency switching |
| `Bizzmudra\Frontend\PublicHandler` | Frontend display, scripts, WC filters |
| `Bizzmudra\Frontend\Widget` | WordPress widget |
| `Bizzmudra\Admin\AdminHandler` | Admin dashboard interface |

### Architecture

The plugin follows a **service-oriented architecture**:

1. `bizzmudra.php` → loads autoloader → initializes `Plugin`
2. `Plugin` → registers lifecycle hooks → initializes services on `init`
3. Each service is a single-responsibility class
4. Dependency injection used where possible
5. Options framework is external and untouched

### Hooks & Filters

The plugin provides numerous hooks and filters for customization. See [Hooks & Filters documentation](docs/hooks-filters.md) for complete reference.

## Support

- **Issues:** [GitHub Issues](https://github.com/codersaiful/bizzmudra/issues)
- **Author:** [Saiful Islam](https://profiles.wordpress.org/codersaiful/)

## License

GPLv2 or later - [https://www.gnu.org/licenses/gpl-2.0.html](https://www.gnu.org/licenses/gpl-2.0.html)

## Changelog

### Version 2.0.0
- **Architecture:** Complete restructure to namespace-based architecture with PSR-4 autoloading
- **New:** `includes/` directory with organized subfolders (Core, Services, Frontend, Admin, Helpers)
- **New:** Centralized `Plugin` class as the main orchestrator
- **New:** Autoloader for automatic class loading
- **New:** Dependency injection in PriceConverter
- **New:** Separate Activator/Deactivator classes
- **New:** README.md in each source directory
- **New:** Comprehensive Bengali documentation
- All existing features preserved - fully backward compatible

### Version 1.0.7
- Added: Compatibility with WooCommerce Latest Version
- Improved: Performance optimizations for faster currency switching
- Fixed: Bug with currency switcher not displaying in certain themes

### Version 1.0.0
- Initial release
- Multi-currency support with manual exchange rates
- Frontend currency switcher
- Automatic price conversion
- Widget and shortcode support
- Display position controls
- Complete Bengali documentation

---

**Note:** Documentation files in the `docs/` folder are written in Bengali (বাংলা) for Bengali-speaking developers and users.
