=== Preview Calculator for WooCommerce ===
Contributors: sotfsdapps
Tags: woocommerce, calculator, price calculator, cost breakdown, fee calculator
Requires at least: 5.5
Tested up to: 6.8
Requires PHP: 7.4
Requires Plugins: woocommerce
Stable tag: 2.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Build custom cost breakdown calculators for WooCommerce. Show transaction fees, taxes, margins, or markups — with optional cart subtotal integration.

== Description ==

**Preview Calculator for WooCommerce** lets you create customizable calculators that break down costs, fees, taxes, and margins right on your WooCommerce store. Perfect for businesses that want transparent pricing breakdowns.

= Use Cases =

* **Transaction fee preview** — Show customers what payment processing fees look like before checkout
* **Tax breakdown calculator** — Display multiple tax components (state, county, city)
* **Margin/markup calculator** — Help B2B buyers understand wholesale vs. retail pricing
* **Shipping cost estimator** — Break down shipping components (base, fuel surcharge, handling)
* **Commission calculator** — Show sellers what their net earnings will be after marketplace fees
* **Tip calculator** — Let customers preview suggested tip amounts based on their order

= Features (Free) =

* Create up to 3 independent calculators
* Each calculator gets its own shortcode
* Add custom deduction fields (label + percentage)
* Choose between **reverse** (deduction) or **additive** (markup) calculation modes
* Toggle to use the WooCommerce cart subtotal instead of manual input
* Works with Elementor, WPBakery, and any shortcode-compatible page builder
* Clean, responsive frontend design
* Full admin settings panel with drag-and-drop field management

= Pro Features =

* **Unlimited calculators** — Create as many as you need
* **Live calculation** — Results update as the customer types (no button click needed)
* **Currency formatting** — Display results with currency symbols and proper formatting
* **Custom decimal precision** — Control decimal places (0-4)
* **Result prefix & suffix** — Add $ signs, currency codes, or custom labels
* **Calculator titles** — Display a heading above each calculator
* **Hide breakdown** — Show only the final result, not individual line items
* **Copy to clipboard** — One-click copy of calculation results
* **Custom CSS per calculator** — Style each calculator independently
* **Gutenberg block** — Place calculators using the block editor, not just shortcodes
* **Priority support** — Direct email support with faster response times

= How It Works =

1. Go to **Preview Calcs** in your WordPress admin
2. Click **Add Calculator** and configure your fields
3. Set labels and percentages for each deduction or markup
4. Choose reverse (deduction) or additive (markup) mode
5. Copy the generated shortcode and paste it on any page
6. Customers enter an amount (or use their cart subtotal) and see the breakdown

= Reverse vs. Additive Mode =

**Reverse (deduction):** Extracts a percentage FROM the entered amount.
Example: $100 with 10% tax → Tax: $9.09, Net: $90.91

**Additive (markup):** Adds a percentage ON TOP of the entered amount.
Example: $100 with 10% markup → Markup: $10.00, Total: $110.00

== Installation ==

1. Upload the plugin files to `/wp-content/plugins/wc-preview-calculator`, or install directly from the WordPress plugin screen.
2. Activate through the **Plugins** screen.
3. Navigate to **Preview Calcs** in your admin sidebar.
4. Create your first calculator and configure the fields.
5. Use the shortcode `[pcfwc_your-slug]` on any page or post.

== Frequently Asked Questions ==

= How many calculators can I create? =
The free version supports up to 3 calculators. Upgrade to Pro for unlimited.

= Does it work with Elementor? =
Yes. Use the shortcode widget in Elementor to place any calculator. Pro users also get a native Gutenberg block.

= Can I use the WooCommerce cart subtotal? =
Yes. Each calculator has a toggle that lets users switch between manual input and using their current cart subtotal (excluding shipping).

= How do I switch between deduction and markup modes? =
In the admin settings for each calculator, check the "Additive Mode" checkbox to switch from deduction to markup.

= Can I style calculators differently? =
Pro users can add custom CSS per calculator. Free users can target the `.pcfwc-calculator` class in their theme's custom CSS.

= Does it work with page caching? =
The calculator itself is JavaScript-based and works with most caching plugins. The WooCommerce cart subtotal feature requires that cart fragments are not cached.

= What shortcode format does it use? =
Each calculator generates a shortcode in the format `[pcfwc_your-slug]`. The slug is shown in the admin panel.

== Screenshots ==

1. Admin panel — create and manage multiple calculators with custom fields
2. Frontend calculator — clean, responsive design with real-time output
3. Pro settings — currency formatting, live calculation, custom CSS, and more
4. Gutenberg block (Pro) — place calculators directly in the block editor

== Changelog ==

= 2.0.0 =
* Major update with Pro tier
* Redesigned admin interface with organized settings panels
* Improved frontend styling (responsive, modern design)
* Added calculator limit for free tier (3 calculators)
* Pro: Unlimited calculators
* Pro: Live calculation (results update as user types)
* Pro: Currency formatting with custom symbol
* Pro: Decimal precision control (0-4 places)
* Pro: Result prefix and suffix
* Pro: Calculator title/header
* Pro: Hide individual breakdown lines
* Pro: Copy result to clipboard
* Pro: Custom CSS per calculator
* Pro: Gutenberg block for block editor
* Separated admin/frontend CSS and JS for better performance
* Added proper text domain and i18n support
* Improved sanitization and security
* Freemius SDK integration for licensing

= 1.1.1 =
* Compatibility update for WordPress 6.8
* Minor bug fixes

= 1.1.0 =
* Renamed plugin to Preview Calculator for WooCommerce
* Added support for multiple calculators via dynamic shortcodes
* Added WooCommerce cart subtotal toggle support
* Switched fields input to dynamic add/remove inputs
* Fixed subtotal issue when cart is empty or unavailable

= 1.0.0 =
* Initial release: single reverse calculator with custom labels and percentages

== Upgrade Notice ==

= 2.0.0 =
Major update! Redesigned admin, improved frontend styling, and Pro features available (unlimited calculators, live calc, currency formatting, Gutenberg block). Free tier now supports up to 3 calculators.
