=== CartMend Payment Method Rules for WooCommerce ===
Contributors: cartmendmodule
Tags: woocommerce, payment methods, payment gateways, conditional payments, hide payment method
Requires at least: 5.5
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.1.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Conditionally hide or show WooCommerce payment gateways with unlimited AND/OR rules. No code. Works on classic and block checkout.

== Description ==

**CartMend Payment Method Rules for WooCommerce** lets you conditionally hide or show payment gateways at checkout — without writing a single line of code. Create as many rules as you need, each targeting one gateway with one or more conditions combined with AND/OR logic. It works on **both** the classic shortcode checkout and the new **block (Gutenberg) checkout**, and it adds **zero JavaScript and zero jQuery** to your storefront.

Common things store owners use it for:

* Hide **Cash on Delivery** for orders over a certain amount (reduce fraud and unpaid COD).
* Hide **PayPal** (or any gateway) for specific billing countries.
* Show a gateway **only** for a chosen country (whitelist mode).

= Features =

* Unlimited rules, each targeting one payment gateway.
* Action per rule: **Hide** or **Show only**.
* Each rule can combine multiple conditions with **AND/OR** logic: **Billing country** (is in / is not in a list) and/or **Cart subtotal** (greater than / less than / equal to / between).
* Enable/disable toggle per rule.
* Admin-only **debug notice** at checkout that tells you exactly which rule fired and why.
* Works on classic checkout, block checkout, and the order-pay page.
* HPOS (High-Performance Order Storage) compatible.
* Lightweight: no frontend JavaScript, no jQuery, no bloat.

== Installation ==

1. Upload the plugin to `/wp-content/plugins/` or install it from **Plugins → Add New**.
2. Activate **CartMend Payment Method Rules for WooCommerce**.
3. Make sure WooCommerce is active and you have at least one payment gateway enabled.
4. Go to **WooCommerce → Settings → Payment Rules**.
5. Add a rule: choose a gateway, an action (Hide / Show only), and one or more conditions (Billing country and/or Cart subtotal). Add more rules or conditions as needed, then save.

== Frequently Asked Questions ==

= Does it work with the new block (Gutenberg) checkout? =

Yes. The core hide/show logic runs server-side through WooCommerce's `woocommerce_available_payment_gateways` filter, which now fires in the block/Store API checkout as well as the classic shortcode checkout and the order-pay page.

= Will it work with Stripe, PayPal, Square and other gateways? =

Yes. The plugin filters whatever active gateways WooCommerce exposes, including third-party gateways, as long as they are enabled in WooCommerce.

= My rule isn't working. What should I check? =

Enable the admin-only debug notice by viewing checkout while logged in as a shop manager/admin — it shows which rule fired and why. Also confirm the gateway is enabled in WooCommerce and that any full-page cache excludes the checkout page.

= Does it slow down checkout? =

No. Rules are evaluated in plain PHP from a single cached option, with no extra database queries during checkout, and no frontend JavaScript.

= Does it collect any data? =

No. The plugin sends no telemetry.

== Screenshots ==

1. The rules screen — manage any number of rules, each with its own gateway, action, and conditions, from one place.
2. Adding a rule — gateway dropdown and condition (Billing Country) with a country multiselect.
3. Checkout before the rule: all payment methods show, including Cash on Delivery.
4. Checkout after the rule: Cash on Delivery is automatically hidden for orders over the threshold.
5. Debug mode shows exactly which rules fired — so you never wonder why a gateway disappeared.

== Changelog ==

= 1.1.4 =
* The free version now supports unlimited rules with AND/OR condition logic.
* Each rule can combine multiple conditions (billing country and/or cart subtotal).
* Added an "equal to" comparison for cart subtotal.
* Removed a leftover empty init hook.

= 1.1.3 =
* Confirmed the plugin ships exactly the billing country and cart subtotal condition types shown in the settings screen.
* Renamed to lead with brand.
* Fixed contributors.
* Moved inline debug style to an enqueued stylesheet.

= 1.0.0 =
* Initial release.
* One rule: hide or show a payment gateway by billing country or cart subtotal.
* Works on classic checkout, block (Store API) checkout, and order-pay page.
* Admin-only checkout debug notice.
* HPOS and Cart/Checkout Blocks compatibility declared.
