=== Minimum Checkout Amount for WooCommerce ===
Contributors: aisimpleplugin
Tags: woocommerce, checkout, minimum amount, woocommerce checkout, cart total
Requires at least: 5.0
Tested up to: 6.9
WC tested up to: 10.3
Stable tag: 1.3.0
Requires PHP: 7.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A lightweight WooCommerce plugin that prevents checkout if the cart total is below a minimum amount.

== Description ==

Minimum Checkout Amount helps WooCommerce store owners enforce a minimum order requirement.  
If a customer's cart does not reach the required minimum amount, the plugin will:

- Show a clear error message on the cart page  
- Block checkout until the requirement is met  
- Optionally include taxes in the calculation  
- Allow excluding specific users from the minimum requirement  
- Automatically exclude Administrators and Shop Managers  

This plugin is lightweight, fast, and fully compatible with WooCommerce HPOS.

== Features ==

* Set a minimum checkout amount
* Show a message when the minimum is not met
* Include or exclude taxes in the calculation
* Exclude specific users from the minimum requirement
* Automatically excludes Admin and Shop Manager roles
* HPOS compatible


== WooCommerce Compatibility ==

This plugin is fully compatible with WooCommerce High-Performance Order Storage (HPOS).

== Installation ==

1. Upload the plugin files to the `/wp-content/plugins/minimum-checkout-amount` directory, or install it via the WordPress Plugins screen.
2. Activate the plugin.
3. Go to **WooCommerce → Settings → Minimum Checkout Amount**.
4. Set your minimum amount and preferences.

== Frequently Asked Questions ==

= Does this plugin support HPOS? =
Yes. The plugin is fully compatible with WooCommerce HPOS.

= Can I exclude specific users? =
Yes, you can exclude individual users in the plugin settings.

= Can I apply the minimum checkout amount to specific user roles? =
Administrators and Shop Managers are automatically excluded. No other role-based exclusions are supported at this time.


== Screenshots ==

1. Settings page
2. Error message on cart page

== Changelog ==

= 1.3.0 =
* Fixed: Custom cart message was never loaded due to a mismatched option key between settings and helpers.
* Improved: Removed the "Place Order" button disabling logic because the cart redirect already prevents customers from reaching the checkout page.
* Fixed: Order validation logic was inverted: user exclusions were checked after the minimum amount, causing excluded users to still fail validation.
* Fixed: Order validation function was defined but never hooked, making it inactive.
* Fixed: Typo in the checkout message option key (minimuncheckoutamout) caused the saved message to never be retrieved.
* Fixed: Trailing whitespace and tab characters were included in the default and placeholder values of the cart message field.
* Security: Added missing ABSPATH guard in validation.php to prevent direct file access.
* Fixed: WooCommerce active check now uses class_exists() inside plugins_loaded, improving compatibility with network-activated plugins on Multisite.
* Fixed: User selector field now guards against (array) false returning [false] when the option is not yet set.
* Improved: Extracted duplicated exclusion logic into shared helper functions to avoid repetition across notices.php.

= 1.2.4 =
* Improved code quality and compliance with WordPress coding standards.
* Fixed minor issues related to settings handling and plugin uninstall cleanup.
* Enhanced internationalization and escaping in admin settings.
* No functional changes for end users.

= 1.2.3 =
* Fixed: i18n issue in settings description string.

= 1.2.2 =
* Fixed: i18n issue in settings description string.

= 1.2.1 =
* Updated: text strings for better translation coverage.

= 1.2.0 =
*Added: customizable minimum checkout warning message setting.
*Added: support for dynamic placeholders {amount} and {difference} in warning messages.
*Preserve:d compatibility with WooCommerce tax calculations based on plugin settings.
*Refactored: validation logic for improved reliability and maintainability.
*Removed: redundant validation methods to prevent duplicate enforcement.
*Improved: message translation fallback handling.
*Minor performance and code cleanup.

= 1.1.7 =
* Added: full HPOS compatibility for WooCommerce.
* Added: uninstall cleanup option to remove plugin settings.
* Improved: validation logic and excluded Administrator & Shop Manager roles automatically.
* Cleaned: and reorganized code for performance and maintainability.
* Updated: translations (fr_FR, es_ES).
* Various: small fixes and enhancements.

= 1.1.6 =
* Improved: compatibility with recent WooCommerce versions.
* Updated: text strings for better translation coverage.
* Minor security and code-quality improvements.

= 1.1.5 =
* Added: option to include taxes in minimum order calculation.
* Enhanced: admin settings layout.
* Improved: cart page validation messages.

= 1.1.4 =
* Added: feature to exclude specific users from the minimum amount requirement.
* Improved: error handling and message formatting.

= 1.1.3 =
* Better handling of manual “pay for order” flows.
* Added: nonce validation to improve security.
* Fixed: inconsistent message display on the checkout page.

= 1.1.2 =
* Improved: minimum amount validation logic.
* Enhanced: WooCommerce compatibility.
* Minor performance improvements.

= 1.1.1 =
* Added: initial settings page.
* Added: option to display messages on the cart and shop pages.
* Improved: translation templates.

= 1.0.0 =
* Initial release.
* Enforces a minimum checkout amount with basic settings.

== Upgrade Notice ==

= 1.5.0 =
This update fixes several issues with cart messages and order validation logic, 
improves compatibility with WooCommerce (including Multisite), and enhances overall code reliability. No action required.

= 1.2.0 =

This update introduces a new customizable warning message setting for the minimum checkout notice.
If no custom message is provided, the default translated message will be used automatically

= 1.1.7 =
This update adds a new uninstall cleanup option and improves validation behavior for administrators and shop managers. No configuration changes are required.
