=== Tomanify – Smart Toman & Rial Currency Manager === Contributors: araoufi Tags: woocommerce, currency, iran, toman, rial Requires at least: 5.2 Tested up to: 6.9 Requires PHP: 7.4 Stable tag: 1.0.2 License: GPL-2.0-or-later License URI: https://www.gnu.org/licenses/gpl-2.0.html Smart currency conversion and Toman/Rial pricing for WooCommerce with live rates, backups, and multilingual support. == Description == **Tomanify** helps WooCommerce stores that list products in foreign currencies *(USD / EUR / AED / TRY / CNY)* and want to automatically convert them into Iranian **Toman** (or **Rial**) using a configurable exchange-rate engine. The plugin is designed to be safe and predictable: * **No external source URLs are pre-filled** inside the plugin. * External requests happen **only** if an administrator explicitly enters URLs. * Converted prices are stored using a **TOMAN baseline** to avoid double-conversion when switching between **Toman** and **Rial**. = Key Features = * Per-product foreign pricing: **foreign flag + currency + foreign amount + margin (%)** * Automatic conversion to **Toman baseline** and storage in WooCommerce price meta * Switch display unit (Toman/Rial) **without re-fetching rates** (rewrites from baseline) * Rate sources (admin configurable): * Live free-market **JSON endpoint** (Toman values) * Official **RSS/XML** (per currency) + premium conversion *(Free/Official)* * **Manual rates** (Toman) * **Offline estimation model** (reference-based) * Bulk editor for all foreign products (**Products tab**) * Frontend widget shortcode: **[tomanify_rates]** *(frontend assets load only when shortcode is used)* * Optional cache purge integration (**OFF by default**) * Backup/Restore (**export/import JSON**) + uninstall cleanup option * Independent plugin language (**fa_IR / en_US**) regardless of site language * RTL/LTR aware admin and frontend UI = Supported Currencies = USD, EUR, AED, TRY, CNY = How it works (one line) = Foreign Price × Rate(Toman) × (1 + Margin/100) → *round to nearest 1000 Toman* → store baseline → write WooCommerce price in selected unit. == Installation == 1. Install and activate the plugin. 2. Go to **WP Admin → Tomanify**. 3. Set your rate source in the **Sources** tab (JSON / RSS/XML / Manual / Offline). 4. Mark products as **Foreign Product (Tomanify)** and enter: * Foreign amount * Currency * Margin (%) 5. Click **Update Rates** (Dashboard tab) or rely on Cron schedule. 6. *(Optional)* Add shortcode **[tomanify_rates]** to show a frontend widget. == Quick Start (Recommended) == = Option A: JSON (Free market) = 1) In **Tomanify → Sources** tab, set **JSON URL**. 2) Your endpoint must return this schema *(values are TOMAN integers)*: {"values":{"USD":60000,"EUR":130000,"AED":30000,"TRY":2500,"CNY":22550}} You can host this JSON on your own server, GitHub Pages, or raw GitHub content. = Option B: Official rates (RSS/XML) = 1) In **Tomanify → Sources** tab, set the official **RSS/XML URL for each currency (HTTPS)**. 2) The plugin converts official Rial to free-market Toman using: *Premium = Free / Official* *Free (Toman) = Official (Rial) / (10 × Premium)* If you don’t know the RSS/XML feed URL, use the official rates page and copy the RSS link for each currency row: https://www.cbi.ir/ExRates/rates_en.aspx (You will see an RSS icon next to each currency. Open it and copy the XML URL into the matching field.) == Recommended Source Links (Optional Copy/Paste) == Important: *These links are OPTIONAL suggestions.* Tomanify does **not** pre-fill them automatically. You may use any valid HTTPS source you trust. = 1) Example JSON endpoint format = You need ONE URL that returns the JSON schema shown above. Example GitHub raw URL format: https://raw.githubusercontent.com////data.json Optional community-maintained JSON URL (use at your own discretion): https://raw.githubusercontent.com/rate-json/default/main/data.json = 2) Central Bank RSS/XML (Copy/Paste per currency) = USD — United States Dollar https://cbi.ir/ExRatesRSS.aspx?cid=1 EUR — Euro https://cbi.ir/ExRatesRSS.aspx?cid=94 AED — United Arab Emirates Dirham https://cbi.ir/ExRatesRSS.aspx?cid=14 TRY — Turkish Lira https://cbi.ir/ExRatesRSS.aspx?cid=38 CNY — Chinese Yuan https://cbi.ir/ExRatesRSS.aspx?cid=85 == Usage == = Mark a product as foreign = Open the product edit screen → **Foreign Product (Tomanify)** box: * Enable **Is foreign product** * Enter **Foreign price** * Choose **Currency** * Enter **Margin (%)** Save the product → Tomanify recalculates using stored rates. = Bulk edit foreign products = WP Admin → **Tomanify → Products** tab Edit foreign price, currency, margin; then **Save**. = Shortcode Widget = Add this shortcode to any page/post: [tomanify_rates] The widget displays: * Title + optional last update time * Unit (Toman/Rial) * Selected currencies table Frontend CSS/JS assets load **only when the shortcode exists on the page**. == Frequently Asked Questions == = Does Tomanify auto-fill any external URLs by default? = No. All source URL fields are empty by default. External requests only happen after an admin enters URLs. = My rates changed a little but products didn’t update. Why? = Check **Change threshold %** in the Advanced tab. Small movements below the threshold are ignored to reduce noise. = Can I use only manual rates? = Yes. Set Source Mode to **Manual** and fill per-currency values (Toman). = Can I switch between Toman and Rial later? = Yes. Tomanify stores a TOMAN baseline per product and rewrites WooCommerce prices when you switch the unit *(no re-fetch needed)*. == Screenshots == 1. Dashboard: update rates button, last update/source info, cron scheduling, and stored rates table. 2. General tab: source mode selection, display unit (Toman/Rial), plugin language, and cache purge toggle. 3. Sources tab: JSON URL, Central Bank (CBI) RSS/XML URLs, and manual rates inputs. 4. Advanced tab: change threshold (%), global premium (Free/Official), CAGR, and factory reset. 5. Shortcode tab: choose currencies, show last update time, and copy shortcode button. 6. Products tab: bulk editor for foreign products (buy price, currency, margin) + computed final price. 7. Backup & Restore tab: export/import backup, and uninstall data removal option. 8. Product edit screen: “Foreign Product (Tomanify)” meta box (foreign flag, currency, price, margin). 9. Frontend: shortcode widget output (glassmorphism rates card). 10. About tab: overview, quick guided tour button, license/credits, and contact info. == External Services == Tomanify can fetch currency-rate data from external URLs that **you provide** in the Sources tab (JSON and/or RSS/XML). Requests happen only when you update rates *(manually or by scheduled cron)*. No customer, order, or personally identifiable information is transmitted by the plugin. == Changelog == = 1.0.2 = * Initial public release on WordPress.org. * Secure admin forms (capability checks + nonces) and full sanitize/validate/escape coverage. * No pre-filled external URLs; external requests only when admin sets URLs. * Optional purge feature is OFF by default and restricted to same-host requests. * Added Backup/Restore and uninstall cleanup option. * Improved RTL/LTR support and independent plugin locale (fa_IR/en_US). == Upgrade Notice == = 1.0.2 = Initial release. == License == GPL-2.0-or-later.