=== TWDH Minimum Order for WooCommerce ===
Contributors:      jseals
Tags:              woocommerce, minimum order, cart, checkout, ecommerce
Requires at least: 6.0
Tested up to:      7.0
Requires PHP:      7.4
Stable tag:        1.0.0
License:           GPLv2 or later
License URI:       https://www.gnu.org/licenses/gpl-2.0.html

Require a minimum cart subtotal before customers can check out in WooCommerce, with a customizable notice and per-role bypass.

== Description ==

TWDH Minimum Order for WooCommerce lets you set a minimum cart subtotal that customers must reach before they can place an order. When a cart falls below the amount you define, WooCommerce blocks checkout and displays a notice you control, so shoppers know exactly how much more they need to add.

This is useful for stores with handling costs, wholesale-style minimums, free-shipping thresholds, or any situation where small orders are not worth fulfilling.

**What it does**

* Enforces a minimum order amount, checked against the cart subtotal on the cart and checkout pages.
* Stops checkout and shows an error notice when the subtotal is below your minimum.
* Lets you write your own notice message with dynamic placeholders.
* Lets you exempt specific user roles (for example, wholesale customers or shop managers) from the requirement.

**What you can configure**

After activation, go to **WooCommerce &rarr; Minimum Order** in your WordPress admin. There you can:

1. **Enable** &mdash; turn the minimum order requirement on or off.
2. **Minimum Amount** &mdash; the lowest cart subtotal (in your store currency) that is allowed to check out. Set it to 0 to effectively disable enforcement.
3. **Notice Message** &mdash; the message shown to customers whose cart is below the minimum. You can use two placeholders:
    * `{amount}` &mdash; the minimum amount, formatted in your store currency.
    * `{total}` &mdash; the customer's current cart subtotal, formatted in your store currency.
   For example: `A minimum order of {amount} is required. Your current cart total is {total}.`
4. **Role Bypass** &mdash; select any user roles that should be allowed to check out regardless of the minimum. Logged-in users with a selected role skip the check entirely.

Settings are validated and sanitized on save, and the minimum is enforced server-side via WooCommerce's standard cart validation, so it cannot be bypassed from the browser.

== Installation ==

1. Upload the plugin folder to the `/wp-content/plugins/` directory, or install the plugin through the WordPress Plugins screen directly.
2. Activate the plugin through the **Plugins** screen in WordPress. (WooCommerce must be installed and active first.)
3. Go to **WooCommerce &rarr; Minimum Order** to enable the requirement and configure your minimum amount, notice message, and any role bypasses.

== Frequently Asked Questions ==

= Does this plugin require any other plugins? =

Yes. WooCommerce must be installed and active. The plugin declares WooCommerce as a required dependency, and all functionality runs on top of the WooCommerce cart and checkout.

= Is the minimum based on the cart total before or after tax and shipping? =

The check uses the cart subtotal (the total of items in the cart), before shipping. This is the amount most stores want to gate on.

= Can some customers skip the minimum? =

Yes. Use the **Role Bypass** section on the settings page to select user roles that should be exempt. Any logged-in user with a selected role can check out regardless of the minimum.

= Where does the notice appear? =

When a customer's subtotal is below the minimum, an error notice (using your configured message) is shown on the cart and checkout pages, and checkout is blocked until the minimum is met.

== Screenshots ==

1. The settings page under WooCommerce &rarr; Minimum Order, showing the minimum amount, notice message, and role bypass options.

== Changelog ==

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
