=== Payment and Shipping Method Checkout Fee for WooCommerce ===
Contributors: vipestudio
Tags: woocommerce, checkout, fee, payment, shipping
Requires at least: 6.2
Tested up to: 6.9
Stable tag: 2.1.0
Requires PHP: 8.0
WC requires at least: 7.0
WC tested up to: 10.7
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Add a percentage or fixed fee to any WooCommerce payment method and shipping method at checkout.

== Description ==

This plugin lets you attach an extra fee — either a percentage of the cart subtotal or a fixed amount — to any WooCommerce payment gateway or shipping method. Configuration lives under **WooCommerce → Settings → Checkout Fee**.

Typical use cases:

* Pass card-processing surcharges to customers paying with specific gateways.
* Add a handling fee for Cash on Delivery.
* Add a packaging/insurance fee for express shipping methods.

Features:

* Per-method configuration — every payment gateway and shipping method has its own settings.
* Choose between a **percentage of cart subtotal** or a **fixed amount**.
* Optional **taxable** flag so the fee can be included in tax calculations when required.
* Customisable fee label shown to the customer.
* Works with the classic checkout and the block-based Cart & Checkout.
* Declares compatibility with WooCommerce High-Performance Order Storage (HPOS).

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/` or install via the WordPress Plugins screen.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Go to **WooCommerce → Settings → Checkout Fee** and configure the fee for each payment or shipping method you need.

== Frequently Asked Questions ==

= Where is the configuration screen? =

WooCommerce → Settings → Checkout Fee.

= Does the percentage fee include shipping or taxes? =

No. The percentage is applied to the cart subtotal (line items, before shipping and taxes). Whether the resulting fee is itself taxed is controlled per method by the **Taxable** option.

= Will it work with the new block-based Checkout? =

Yes. The plugin hooks into `woocommerce_cart_calculate_fees`, which fires for both classic and block-based checkout. The block checkout automatically recalculates totals when the customer switches payment method via the Store API.

= Is it compatible with WooCommerce High-Performance Order Storage (HPOS)? =

Yes — compatibility is declared with both `custom_order_tables` and `cart_checkout_blocks`.

== Changelog ==

= 2.1.0 =
* Fix: percentage and fixed fees were never actually added to the cart because of a mismatch between the option key used by the settings UI and the one read at checkout. Fees now apply as configured.
* Fix: activation routine no longer deletes existing per-method settings and no longer force-resets the fee type to "percentage" on every activation.
* Fix: removed `is_plugin_active()` call that could fatally error during activation on some hosts.
* New: per-method **Taxable** option (previously every fee was implicitly taxable, with no way to change it).
* New: declares compatibility with WooCommerce HPOS and Cart & Checkout Blocks.
* New: one-time migration of legacy option keys (`{id}_name_label`, `{id}_name_percent`, `{id}_fee_type`) to a clean, prefixed namespace (`pmcf_{id}_*`).
* New: own text domain `payment-method-checkout-fee-for-woocommerce` (previously strings used the `woocommerce` domain).
* Improvement: configuration now lists every registered payment gateway, not just those available for the current empty admin cart.
* Improvement: scripts are now enqueued via `wp_enqueue_scripts` and only on the checkout page.
* Improvement: multi-package carts no longer apply the same shipping-method fee multiple times.
* Cleanup: removed unused Monolog dependency and `vendor/` directory, shrinking the plugin download significantly.
* Cleanup: removed dead admin page and orphaned admin JS/CSS that were not wired up to anything.
* Tested up to WordPress 6.9 and WooCommerce 10.7.

= 2.0.1 =
* Bug fixing with label title.

= 2.0.0 =
* Major update with significant improvements.
* Settings moved into the WooCommerce Settings tab.
* Enhanced code quality.
* Added an option to set a fixed fee.
* Added support for shipping method fees.

= 1.2 =
* Code Improvement.
* Added checks if WooCommerce is enabled so the website won't crash if you disable it.

= 1.0.0 =
* Initial Release — 19.11.2019.

== Upgrade Notice ==

= 2.1.0 =
Important bug-fix release: fees configured in 2.0.x were never applied because of an internal option-key mismatch. Update and verify your fees show on the checkout. Existing settings are migrated automatically.

== Screenshots ==

1. You can find the configuration under WooCommerce → Settings → Checkout Fee.
2. Setup is that simple.
3. Frontend.
