=== Wholesale Prices and Min Order for WooCommerce ===
Contributors: catcodestudio
Tags: woocommerce, wholesale, b2b, minimum order, quantity step
Requires at least: 5.6
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Wholesale prices per customer role, a minimum order amount, quantity steps and pack selling — B2B rules for WooCommerce.

== Description ==

A shop that sells both retail and wholesale keeps a single price per product in WooCommerce. This plugin adds a second level: a wholesale price for the customer roles you choose, a minimum order amount, and quantity rules — step, minimum and selling in whole packs.

Prices are calculated at display time and are never written back into the products: disable the plugin and the shop instantly returns to its retail prices, with nothing left to clean up. A wholesale rule never raises a price: if the shop's own sale price is the better deal, that one stays.

= Free features =

* Wholesale prices per customer role: a fixed price, a percentage discount or a fixed-amount discount
* Up to 5 rules for individual products; guests can be targeted too (the "Guest" role)
* A minimum order amount that either blocks checkout or only shows a warning
* The minimum is compared against the cart subtotal, with or without tax
* Minimum quantity and quantity step — globally, and per product or variation
* An invalid quantity is corrected instead of rejected: up, down or to the nearest allowed value
* Works with both the classic and the block cart/checkout (Store API), HPOS compatible
* Variable products: prices and quantities are resolved per variation

= Pro features =

* Rules by product category (including subcategories) and by product tag
* Catalogue-wide rules — for example "-10% for dealers on everything"
* Tiered prices by quantity: "from 10 pcs one price, from 50 pcs another", with a threshold table on the product page
* Selling in packs of N units — the step and the minimum both become the pack size
* Separate minimum order amounts per customer role
* Hiding prices from guests, with a link to the login page
* CSV export of the rule set

A fresh install is simply the free tier — nothing Pro switches itself on. Pro features stay visible where they belong, greyed out and marked "Pro", so you can see the boundary before you pay for it. If you want to try them, the settings screen has a "Try Pro for 7 days" button: you enter an e-mail and get a real 7-day key, no card needed. The trial never starts on its own, and the free tier keeps working with no time limit once it ends. Licences are annual (1–5 years) and include updates and support for that term.

= Requirements =

* WooCommerce 7.0 or newer
* PHP 7.4+

The plugin interface is fully translated into Ukrainian. / Інтерфейс плагіна повністю перекладено українською.

== Installation ==

1. Upload the plugin and activate it.
2. Go to WooCommerce → "Опт: гуртові ціни" (Wholesale).
3. Enable wholesale prices and add a rule: pick the customer roles, the products and the discount.
4. Optionally enable the minimum order amount and the quantity rules.

== Frequently Asked Questions ==

= How do I set a wholesale price for one group of customers? =

Create a user role for your wholesale customers (with any role plugin, or manually) and select it in the "Customer roles" field of the rule. An empty field means "any role".

= Does the plugin change prices in the database? =

No. The price is substituted at display time through the standard WooCommerce filters, so your regular and sale prices stay untouched.

= What happens if the product is already on sale? =

Whichever is cheaper for the customer wins. A wholesale rule never makes a product more expensive.

= Why is the wholesale price shown as a sale price, with the retail price struck through? =

That is how WooCommerce renders any reduced price. It is intentional: the customer immediately sees the saving, and the theme needs no changes at all.

= The quantity in the cart changed by itself. Why? =

The product is sold with a step or in packs, and the entered quantity did not fit the grid. The plugin corrects it and shows a notice — so an order is not lost because of a typo.

= Does the minimum order amount include shipping? =

No. Shipping is not known yet at the cart stage, so the cart total is compared — with or without tax, as configured in the settings.

= Does it work with the block cart and checkout? =

Yes. The minimum amount is returned as a Store API error, and prices and quantities are applied exactly as in the classic mode.

== Screenshots ==

1. Wholesale price rules in the settings
2. Minimum order amount and per-role minimums
3. Quantity, step and packs
4. The tiered price table on the product page

== Changelog ==

= 1.1.0 =
* Free is free: a fresh install no longer switches Pro on by itself. The 7-day trial now starts only when you click "Try Pro for 7 days" and enter an e-mail — you get a real key, exactly like a purchased one.
* Licence keys are now checked against the CatCode licence server (activate on save, re-checked once a day). If the server is unreachable, Pro keeps working for another 14 days.
* Pro fields stay on screen greyed out with a "Pro" badge and a line explaining what they give you, instead of disappearing.
* Saving the settings no longer wipes Pro values you cannot edit on the free tier (pack size, per-role minimums, hidden prices, quantity tiers).
* One dismissible notice instead of a recurring trial banner — it appears after the plugin has actually done something, and never comes back once closed.

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.1.0 =
The automatic 7-day Pro trial is gone: Pro now unlocks with a licence key or a trial you start yourself. Your rules and settings are untouched.

= 1.0.0 =
Initial release.
