=== WD Quantity Discounts for WooCommerce ===
Contributors: wdonlinedk
Donate link: https://paypal.me/wdonlinedk
Tags: woocommerce, quantity discount, bulk pricing, volume discount, pricing
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.6
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Add fixed unit-price quantity discount tiers to WooCommerce products and customize displayed text and frontend styling from plugin settings.

== Description ==

WD Quantity Discounts for WooCommerce lets you define fixed unit-price tiers directly on each WooCommerce product.

Example rules:

3|8
5|7

This means:

* From 3 items, the unit price becomes 8.
* From 5 items, the unit price becomes 7.

The plugin automatically applies the correct unit price in the cart and checkout.

Frontend, product-editor, and validation text can be customized under WD Online > Quantity Discounts, making it easy to use the plugin in any language without editing code.

Features:

* Fixed unit-price quantity tiers per product.
* Parent-product rules are used as a fallback for variations.
* Automatic pricing in cart and checkout.
* Quantity tier information on product pages.
* Optional message on shop and category pages.
* Customizable text strings from plugin settings.
* Optional frontend styling controls with Classic, Minimal, Modern, and Custom presets.
* Live styling preview in the plugin settings.
* Custom colors, spacing, font sizes, tier markers, border radius, and box shadow.
* Validation prevents higher quantity tiers from having a higher unit price than lower tiers.
* Translation-ready code.
* No external services or tracking.
* HPOS compatible.
* Seamless fallback for existing `_bk_quantity_discounts` rules from the original snippet.

== Installation ==

1. Upload the plugin ZIP through Plugins > Add Plugin > Upload Plugin.
2. Activate the plugin.
3. Edit a WooCommerce product and find the Quantity discounts field in the pricing section.
4. Enter one tier per line, for example `3|8` and `5|7`.
5. Go to WD Online > Quantity Discounts to customize displayed text and optional frontend styling.

== Frequently Asked Questions ==

= What does 3|8 mean? =

It means that when a customer buys 3 or more units, the unit price becomes 8 in the store currency.

= Can I use decimal prices? =

Yes. Both decimal points and decimal commas are accepted in product rules.

= Can I translate the visible text without a translation plugin? =

Yes. Go to WD Online > Quantity Discounts and change the text strings directly.

= Which placeholders can I use in the discount tier text? =

Use `{qty}` for the minimum quantity and `{price}` for the formatted unit price.

= Can I change the appearance of the quantity discount box? =

Yes. Go to WD Online > Quantity Discounts and enable the frontend styling controls. You can choose Classic, Minimal, or Modern, or select Custom to configure colors, spacing, font sizes, tier markers, border radius, and box shadow.

= Will updating change my existing design automatically? =

No. Enhanced styling is disabled by default after updating, so existing stores keep the previous frontend appearance until styling is enabled.

== Changelog ==

= 1.0.6 =
* Removed direct GET processing from admin asset detection to resolve Plugin Check nonce verification warnings.
* Kept frontend styling and discount behavior unchanged.

= 1.0.5 =
* Added optional frontend styling controls under WD Online > Quantity Discounts.
* Added Classic, Minimal, Modern, and Custom style presets.
* Added live preview for styling changes.
* Added custom controls for colors, spacing, font sizes, tier markers, border radius, and box shadow.
* Kept the version 1.0.4 frontend appearance as the default for backward compatibility.

= 1.0.4 =
* Removed the obsolete manual plugin text-domain loader; WordPress automatically loads translations for WordPress.org-hosted plugins.
* Removed the unused Domain Path header to resolve Plugin Check warnings.

= 1.0.3 =
* Fixed an infinite-recursion bug in server-side quantity-rule validation introduced in 1.0.2.
* Unified rule parsing so validation and storefront pricing use the same normalized rule parser.

= 1.0.2 =
* Added validation so unit prices cannot increase as quantity tiers increase.
* Added instant validation in the WooCommerce product editor.
* Added a customizable validation error message under WD Online > Quantity Discounts.

= 1.0.1 =
* Fixed WooCommerce initialization so the quantity-discount field reliably appears in the classic product editor.
* Moved plugin settings to the shared WD Online admin menu.

= 1.0.0 =
* Initial release.
* Per-product fixed unit-price quantity tiers.
* Product, cart, checkout, and archive integration.
* Customizable text settings.
* Variation parent fallback.
* HPOS compatibility declaration.
* Legacy rule migration support for the original code snippet.
