=== SPP Dynamic Sale Badges ===
Contributors: simpli
Tags: woocommerce, sale badge, discount, percentage, sale label
Requires at least: 6.0
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

Replace generic WooCommerce "Sale!" labels with dynamic percentage-off badges calculated from real product pricing.

== Description ==

SPP Dynamic Sale Badges improves buyer decision-making by showing the exact structural price drop directly inside WooCommerce sale labels.

Instead of a static "Sale!" flash, the plugin:

* Hooks into `woocommerce_sale_flash` and replaces the default fallback markup
* Reads each product's regular and sale prices
* Calculates the percentage decrease
* Outputs a clean, accessible HTML badge (e.g. `-25%`)
* Supports WooCommerce block sale badges via `woocommerce_sale_badge_text`
* Handles simple, variable, and grouped products (uses the highest discount for multi-price products)
* **9 label formats** — `-25%`, `25% OFF`, `SAVE 25%`, `SAVE $10`, `UP TO 25% OFF`, and more
* **9 visual styles** — pill, circle, ribbon, outline, gradient, minimal, dark, neon
* Settings page at **WooCommerce → Sale Badges**

Developed for [Simpli](https://simpli.com/).

== Installation ==

1. Upload the `spp-dynamic-sale-badges` folder to `/wp-content/plugins/`.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Ensure WooCommerce is installed and active.
4. Visit any shop or product page with items on sale — badges will show the discount percentage automatically.
5. Customize label format and visual style under **WooCommerce → Sale Badges**.

== Frequently Asked Questions ==

= Does this work with block themes? =

Yes. The plugin filters both classic template output (`woocommerce_sale_flash`) and block-based sale badges (`woocommerce_sale_badge_text`).

= How is the percentage calculated for variable products? =

The plugin evaluates each on-sale variation and displays the highest discount percentage, giving buyers the strongest value signal.

= Can I customize the badge text or HTML? =

Yes. Use the settings page at **WooCommerce → Sale Badges**, or these filters:

* `spp_dsb_label_formats` — register custom label formats
* `spp_dsb_visual_styles` — register custom visual styles
* `spp_dsb_active_label_format` / `spp_dsb_active_visual_style` — override the selected variation
* `spp_dsb_discount_percentage` — modify the calculated percentage
* `spp_dsb_sale_badge_label` — change the visible label
* `spp_dsb_sale_badge_html` — override the full HTML output

== Changelog ==

= 1.1.0 =
* Added 9 label formats and 9 visual badge styles.
* Added WooCommerce → Sale Badges settings page with style previews.

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.1.0 =
Adds badge label formats, visual styles, and a WooCommerce settings page.

= 1.0.0 =
Initial release.
