=== Demfilz Quantity Discounts for WooCommerce ===
Contributors: demfilz
Tags: quantity discount, bulk discount, tiered pricing, volume pricing, dynamic pricing
Requires at least: 6.2
Tested up to: 7.1
Stable tag: 1.0.0
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Bulk and tiered quantity discounts: percentage off, amount off or a fixed unit price per tier, with a live pricing table on the product page.

== Description ==

Buy more, pay less. Set quantity tiers such as "10% off 5 or more, 15% off 10 or more" and the cart prices every line from the tier its quantity reaches. Customers see the tiers on the product page before they buy, and the cart tells them how many more to add for the next saving.

**Three kinds of tier**

* Percentage off each item: 5+ at 10% off, 10+ at 15% off.
* Amount off each item: 12+ at $1.50 off each.
* Fixed price per item: 1+ at $10.00, 10+ at $8.50, 50+ at $7.00. Ideal for wholesale price breaks.

**Rules for the whole store, categories or products**

* A rule covers all products, chosen categories (subcategories included) or chosen products and variations.
* Leave out individual products from any rule.
* Limit a rule to customer roles, for example wholesale customers only, or guests only.
* Schedule a rule with a start and end date.
* Priorities decide which rule wins when several cover the same product, or let the customer get the best price automatically. Discounts never stack.
* Duplicate, disable and re-enable rules from the list.

**Per-product tiers**

Every product gets a Quantity discounts tab. Use the store rules, set tiers for that product alone, or switch quantity discounts off for it.

**Three ways to count quantity**

* Per product: all variations of a product count together (2 small + 3 large shirts = 5 shirts).
* Per cart line: each variation counts on its own.
* Mix and match: every product a rule covers counts together, so "any 6 pairs of socks for 20% off" works across styles.

**What customers see**

* A pricing table on the product page (above or below the add to cart button, below the summary, or only where you place a shortcode) with the quantity ranges, the discount and the price per item.
* The row for the chosen quantity lights up and a live line shows the total and the saving as the quantity changes. Variable products fill in the prices when a variation is chosen.
* An optional "Buy more, save up to 20%" line under products on shop and category pages.
* In the cart, the original price struck through next to the discounted one, the discount under the item, and a hint such as "Add 3 more to pay $8.00 each".

**Correct everywhere**

* Works with the classic cart and checkout and with the cart and checkout blocks, and in the mini cart.
* Prices are set on the cart line itself, so taxes, coupons, shipping and payment gateways all see the discounted price. There is no negative fee line.
* The discount is worked out from the product's stored price, so plugins that adjust prices through WooCommerce's price filters (currency converters, for example) apply on top of it exactly as they do on a normal price, and paid options added to a line by other extensions are kept.
* Unit prices are rounded to your store's decimals, so quantity times unit price always equals the line total.
* Each order line records the discount it received, shown on the order screen, emails and invoices.
* Sale items: discount the sale price, discount the regular price and charge whichever is lower, or skip sale items.
* Compatible with WooCommerce High-Performance Order Storage (HPOS).
* No external services. Nothing leaves your site. Deactivate the plugin and your prices are untouched.

**For developers**

Filters: `dqdw_sources`, `dqdw_discounted_price`, `dqdw_should_apply`, `dqdw_cart_item_eligible`, `dqdw_customer_roles` and `dqdw_pricing_table_html`.

== Installation ==

1. Install and activate the plugin. WooCommerce must be active.
2. Go to WooCommerce > Quantity Discounts and click Add rule.
3. Choose what the rule applies to, the discount type and the tiers, then save.
4. Open a product the rule covers to see the pricing table, and add a few to the cart.

To give one product its own tiers, edit the product and open its Quantity discounts tab.

== Frequently Asked Questions ==

= How do tiers work? =

Each tier applies from its quantity up to the next tier. With 5 at 10% and 10 at 15%, one to four items are full price, five to nine are 10% off and ten or more are 15% off. The discount applies to every item on the line, not only the ones above the threshold.

= Can a tier start at 1? =

Yes. With the fixed price type that lets you write a whole price list: 1+ at $10, 10+ at $9, 50+ at $8.

= Which wins, a product's own tiers or a rule? =

A product's own tiers always win. Otherwise the rule with the lowest priority number is used, or the one that gives the lowest price if you choose that in the settings.

= Do discounts stack with each other? =

No. Each cart line gets one tier from one source. Coupons still apply on top, as they do to any price.

= Does it work with variable products? =

Yes. Rules can target the whole product or single variations. Choose whether the variations of a product count together or separately. The pricing table fills in each variation's prices when the customer picks it.

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

Yes. The discounted price, the struck-through original price, the discount note and the next-tier hint all appear in the block cart as well.

= How are sale prices handled? =

You choose: apply the quantity discount to the sale price, apply it to the regular price and charge whichever is lower, or give no quantity discount on sale items.

= Can I show the table somewhere else? =

Choose "Only where I place the shortcode" as the position and put `[dqdw_pricing_table]` in a product template, or `[dqdw_pricing_table product="123"]` on any page.

= Why does the shop page show the normal price? =

Catalogue prices are not changed, because the discount depends on how many the customer buys. Turn on the shop badge in the settings to advertise the saving on shop and category pages.

== Screenshots ==

1. The rule list.
2. Editing a rule: scope, discount type, tiers, counting, roles and schedule.
3. The pricing table on a product page, with the chosen quantity highlighted and the live total.
4. The cart with the discounted price, the discount note and the next-tier hint.
5. A product's own tiers in its Quantity discounts tab.
6. Settings.

== Changelog ==

= 1.0.0 =
* First release.

== Upgrade Notice ==

= 1.0.0 =
First release.
