=== Conditional Payments, Shipping & Fields for WooCommerce ===
Contributors: addonsorg
Tags: woocommerce, conditional checkout, conditional payments, conditional shipping, checkout rules
Requires at least: 5.0
Tested up to: 7.1
Stable tag: 2.0.0
WC requires at least: 6.0
WC tested up to: 11.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Create advanced conditional rules to control checkout behavior, payment methods, shipping destinations, and customer eligibility in WooCommerce.

== Description ==

[youtube https://www.youtube.com/watch?v=UpWLeh7m3oE]

**Conditional Checkout for WooCommerce** lets you define powerful rules that control how checkout behaves based on cart contents, customer data, shipping destinations, and more.

Instead of hiding fields or countries, the plugin can **validate conditions and display a custom notice when customers attempt to place an order**, ensuring clarity and compliance with business rules.

The plugin works with **both Classic Checkout (shortcode)** and **WooCommerce Checkout Blocks**.

The plugin settings are organized into **four dedicated tabs**, making it easy to manage different checkout controls independently.

**Document:** <https://add-ons.org/document-conditional-checkout-for-woocommerce-conditional-payment-conditional-shipping-conditional-checkout-fields/>
**PRO Version:** <https://add-ons.org/plugin/yeecheckout-pro/>
**Demo:** <https://demo.add-ons.org/woocommerce-demo/product/wordpress-pennant/>

### Typical use cases

- Restrict payment methods by cart content, total, or customer role
- Validate shipping destination (country / state) before order submission
- Prevent checkout for specific customers or email domains
- Enforce business rules with clear custom notices
- Apply conditional logic without breaking WooCommerce UX

== Conditional Payments ==
Control the availability of payment gateways based on defined conditions.

- Enable or disable specific payment gateways
- Only selected gateways are affected; all others remain unchanged
- Compatible with WooCommerce Payments and third-party gateways
- Conditions are evaluated dynamically during checkout


== Conditional Shipping Destinations ==
Validate customer shipping destinations without hiding any checkout fields.

- Select allowed or disallowed countries and states
- Countries and states are NOT hidden from checkout
- Validation runs when the customer places the order
- A custom notice is displayed if the selected destination is not allowed
- Fully compatible with Checkout Blocks

This approach avoids UX issues caused by dynamically hiding country or state fields.


== Conditional Shipping, Billing, Note Fields ==
Define the message shown to customers when a rule prevents checkout.

- Custom message per rule
- Clear and user-friendly checkout error notices
- Useful for explaining business, legal, or shipping restrictions
- Displayed only when conditions are met


== Conditional Rules ==
Define the logic that determines when a rule should apply.

- Cart total
- Cart quantity
- Cart weight (unit is taken from WooCommerce settings)
- Products in cart (include / exclude)
- Product categories
- Brands (taxonomy-based)
- Shipping class
- Billing country / state
- Shipping country / state
- Customer role
- Customer email (supports wildcard matching, e.g. *@example.com)
- Order status

Multiple conditions can be combined to create advanced rule logic.

### Frontend Compatibility
- Classic checkout (shortcode)
- WooCommerce Checkout Blocks
- Server-side validation (reliable with Blocks)
- No country/state hiding → no checkout breakage
- Compatible with HPOS (High Performance Order Storage)

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/`
2. Activate **Conditional Checkout for WooCommerce**
3. Go to **WooCommerce → Settings → Conditional Checkout**
4. Create your rules and conditions
5. Test on checkout (classic or block)

== Frequently Asked Questions ==

= Does this plugin hide countries or states? =
No. The plugin validates conditions when the customer places the order and shows a notice if the destination is not allowed.

= Does it work with Checkout Blocks? =
Yes. The validation runs server-side and works with both Classic Checkout and Blocks.

= Can I restrict by multiple countries or states? =
Yes. Country and state fields support multi-select.

= Can I match multiple customer emails? =
Yes. Use comma-separated emails. Wildcards are supported:
`*@example.com` will match all emails from that domain.

= Will this break my payment gateways? =
No. Only selected gateways are affected. All others remain unchanged.

== Screenshots ==

1. Rules management table
2. Rule editor with conditions
3. Shipping Destinations settings
4. Custom notice on checkout
5. Payment gateway restriction example

== Changelog ==

= 1.0.0 =
* Initial release