=== DiscountWizard for WooCommerce ===
Contributors: highwebservices
Donate link: https://highwebservices.ro/
Tags: woocommerce, discounts, sales, bulk pricing, campaigns
Requires at least: 5.8
Tested up to: 6.8
Requires PHP: 7.4
Stable tag: 4.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Sale campaigns for any WooCommerce store: scheduled percent discounts, gift bundles, free-shipping campaigns and a Black Friday module with your own logo, colours and optional Early Access.

== Description ==

DiscountWizard allows store managers to:

* Create campaigns that apply percentage discounts across one or more product categories.
* Optionally include subcategories automatically.
* Target individual products by pasting product links (can be mixed with category links).
* Target simple products and/or variable product variations.
* Toggle campaigns ON/OFF with a single click.
* Schedule campaigns to start and stop at specific times (using WP‑Cron).
* View campaign history logs for transparency.
* Create gift bundles: "buy these products, get a gift" with a step-by-step configurator on product pages, variation selection, optional free shipping and scheduling.
* Run free-shipping campaigns with ON/OFF and scheduling.
* Run Black Friday: countdown overlay page and homepage pop-up, live prices (campaign % or fixed prices), gift offers, top bar, notices – optional Early Access for a list of customer e-mails.
* Brand it for any store: logo (site logo, any image or none), accent / background / text colours, all front-end texts editable.

**Example use cases:**
* Seasonal sales (e.g. Back to School, Black Friday).
* Category‑wide promotions.
* Time‑limited discounts.

**Features:**
* Bulk pricing adjustments by category.
* Automatic recalculation of variable product parent prices.
* Campaign scheduling with automatic ON/OFF.
* Campaign logs with the last 500 entries.
* Admin UI integrated under the WooCommerce menu.

== Installation ==

1. Upload the plugin files to the `/wp-content/plugins/discountwizard` directory, or install directly from the WordPress.org plugins screen.
2. Activate the plugin through the 'Plugins' screen in WordPress.
3. Find the "DiscountWizard" submenu under **WooCommerce**.
4. Create your first campaign by pasting category links, setting a discount percentage, and choosing product types.

== Frequently Asked Questions ==

= Do I need to edit each product manually? =
No. Campaigns apply discounts in bulk across selected categories.

= Can I schedule campaigns to run automatically? =
Yes. You can set a "From" and "To" date/time. The plugin will automatically turn the campaign ON and OFF using WP‑Cron.

= Does it work with variable products? =
Yes. You can apply discounts to variations. Parent prices are automatically synchronized.

= What happens when I turn a campaign OFF? =
The sale prices created by that campaign are cleared, returning products to their regular prices.

== Screenshots ==

1. Admin campaign list with status badges and actions.
2. Campaign creation form with category URLs and scheduling options.
3. Campaign logs accordion with history entries.

== Changelog ==

= 4.1.0 =
* Black Friday → "Around the site": new option (ON by default) – while Black Friday is live, every product already on sale (sale price, scheduled sale, other discount campaigns) also gets the Black Friday badge in lists, the Black Friday notice with countdown on the product page and counts for the cart notice. The % shown is the bigger of the Black Friday % and the product's own sale %.

= 4.0.0 =
* Generic: the plugin no longer contains anything store-specific – new installs start empty (no pre-created bundles, offers or fixed prices). Existing data and settings are kept on update.
* Black Friday → Early Access can be switched ON/OFF. When OFF (or no member e-mails), the overlay shows a single countdown, Early Access texts are hidden and prices start for everybody at the same time.
* Logo source: site logo (Customizer), another image (Media Library picker) or no logo, with preview.
* Colours: accent, text on accent, background, text on background – with a live preview in admin; all front-end elements (overlay, pop-up, top bar, notices, badges) follow them, so light themes work too.
* Admin texts and placeholders made generic; text domain unified to "discountwizard" and translations load from /languages.
* WordPress timezone warning in admin when the site is set to UTC.

= 3.11.2 =
* Admin: warning when the WordPress timezone is UTC (all schedules use it), and the current store time is shown next to the Black Friday interval.

= 3.11.1 =
* Homepage Black Friday pop-up: at most once every N minutes per visitor (default 10, 0 = every visit). Seeing the Black Friday page overlay counts too, so "Înapoi în magazin" no longer opens the homepage pop-up right away. Works with page cache (checked in the browser before the page is painted).

= 3.11.0 =
* New: Black Friday pop-up on the homepage at every visit, compact (always fits the screen, no scrolling) with an orange X (Esc also closes).
* Before the start: countdowns (Early Access members + everybody). After the start: "A început!" + discount + button to the offers + "ends in" countdown.
* Settings: enable/disable, button target (any page or custom URL, default the Black Friday page), editable texts, preview links for both states.

= 3.10.0 =
* New: Black Friday fixed prices – "price + product link" per line; the BF sale price applies to all variations during the Black Friday interval (Early Access included). Variations already cheaper keep their price; with a % discount too, the lower price wins.
* Admin check table: normal price (range), Black Friday price, discount per product, warning when a fixed price is not lower.
* Variable products in Black Friday always show the old price struck through.
* Fixed-price products appear on the [dwz_black_friday] page and get "-X%" badges.
* Default list created with the 7 Stokke packages.

= 3.9.0 =
* New: Black Friday gift offers – "buy A, choose N gifts from a list" (e.g. 2 of 3, or 1 of 1). Active only while Black Friday is live (Early Access included).
* Pop-up on "Add to cart" for A (product page + AJAX shop buttons): choose gifts, pick variations, the gift image follows the chosen variation.
* Gifts at 0 lei, quantity follows A, removed with A or when Black Friday ends; "Cadou Black Friday" line meta on orders.
* Cart/checkout notice to choose or change gifts (also covers block-based add-to-cart buttons and customers who skipped the pop-up).
* Product page box with the gifts (teaser before the start), "Oferte cu cadou" section in [dwz_black_friday].
* Default offers created: YOYO⁵ 6 luni (2 of 3 gifts) and YOYO⁵ 2în1 (cup holder).

= 3.8.3 =
* [dwz_black_friday] now builds itself from the active Black Friday discounts: one section per category + one section with the products added by direct link (title editable). No more manual category selection; only discounted products are shown.

= 3.8.2 =
* Black Friday page: no flash of the page behind the overlay (page painted black and hidden from the first frame, overlay printed at the top of <body>).
* Top bar simplified: only "BLACK FRIDAY" + "Vezi ce urmează" before the start (no timers); "a început · până la -X%" + "Vezi ofertele" during.

= 3.8.1 =
* Black Friday overlay: logo without the white frame; option to show a black-on-white JPG logo in white, without its background.
* All overlay texts are editable from the Black Friday tab ({ore} = Early Access hours).

= 3.8.0 =
* Black Friday: "VIP" renamed to "Membri Early Access" everywhere.
* Overlay: Stokke logo on top, two countdowns (Membri Early Access + Pentru toată lumea), animated orange light, Romanian dates, orange "Înapoi în magazin".
* Top bar shows the countdowns before the start too (Early Access + everybody); fallback for themes without wp_body_open().
* Admin preview can simulate "before start" (overlay, countdown bar) or "running".
* Carts created before the start/end switch prices on time everywhere (stored totals, mini-cart fragments are refreshed).

= 3.7.0 =
* New: Black Friday tab – own discount campaigns (category/product links, % off, subcategories, product types), applied live during the Black Friday interval (no database price changes).
* New: VIP early access – a list of e-mails (existing or future accounts) gets Black Friday N hours (default 24) before everybody else.
* New: Black Friday page – full-screen countdown overlay until the visitor's own start (VIP or normal), opens automatically at zero.
* New: shortcode [dwz_black_friday] – selected categories with products, discount badges and "see all" buttons.
* New: top bar (homepage or all pages), product notices, shop badges, cart/checkout notices; Stokke orange + black, configurable.
* New: "Admin preview" mode – only shop managers see Black Friday; overlay preview link.
* Watchdog logs Black Friday phases and purges caches; Automation tab lists VIP/start/end times.

= 3.6.0 =
* New: automation watchdog (every minute) so everything scheduled starts and stops on time: % discount campaigns (catches missed WP-Cron events), gift bundles, free shipping campaign and WooCommerce's own product sale schedules (Woo only processes those once a day).
* New: secure server-cron URL (?dwz_cron=KEY) for cPanel, plus WP-Cron and a traffic fallback.
* New: page caches (LiteSpeed, WP Rocket, W3TC, WP Super Cache, SiteGround, WP Fastest Cache, Breeze, Nginx Helper, Autoptimize, Cache Enabler, Hummingbird) and Woo transients are purged at every start/stop.
* New: "Automation & Cron" tab – cron health, ready-to-paste cPanel command, upcoming starts/stops, run check / purge cache now.
* Fix: saving a gift bundle with a schedule now switches it ON (before, a bundle left OFF never started).

= 3.5.0 =
* New: "Campanie Transport Gratuit" tab – turn free shipping ON/OFF instantly, or schedule From / To (starts and stops by itself).
* Optional minimum cart value ("Mai adaugă X lei pentru transport GRATUIT" in cart).
* Customer message with {min} / {until} placeholders, shown as a top bar, on product pages and in cart/checkout (classic and blocks); configurable shipping label and bar colors.
* Admin countdown shows days for long intervals.

= 3.4.0 =
* Fix: wizard / banner buttons no longer turn white-on-white when the theme or page builder restyles buttons on hover/focus.
* New: "Nu vreau pachet" button in the wizard adds only that product to the cart (respects the WooCommerce "redirect to cart after add" setting). The wizard starts with the product of the current page.
* Skipping a single product is still possible via a discreet "Sari peste acest produs" link.
* New: "Bundle appearance" tab – colors for buttons, titles, text, backgrounds, gift/success accents, corner radius and button texts, with live preview.

= 3.3.0 =
* New: Gift bundles tab. Define products to buy (links), how many are required, gift products and how many gifts can be chosen.
* New: Product page banner + wizard (variation selection, skip products, choose gift), shop badges, cart/checkout/mini-cart notices (classic and block cart/checkout).
* New: Gifts are added at price 0, quantity locked, removed automatically when the bundle no longer qualifies; order line meta "Cadou".
* New: Optional free shipping when the bundle qualifies, shown in banner, cart, checkout and thank-you page.
* New: Bundle scheduling (From / To), checked live.
* New: Shortcode [dwz_bundle] / [dwz_bundle id="..."].
* Default "Pachet Stokke Nomi" bundle is created (OFF) on first load.
* Admin: notices from other plugins are no longer shown on the DiscountWizard screen.
* Admin: fixed nested forms on the campaigns screen.

= 3.2.0 =
* The links field now accepts product links as well as category links (mixed, one per line).
* Product links are always discounted (simple and variable); the product type option applies to category links.
* Unrecognized links are reported in a warning after saving.
* Variable parent products are synced once per campaign run.

= 3.1.0 =
* Initial public release on WordPress.org.
* Admin UI rebuilt with accessibility and i18n support.
* Campaign scheduling added.
* Cron cleanup and uninstall routine implemented.

== Upgrade Notice ==

= 3.1.0 =
First stable release of DiscountWizard — includes campaign scheduling, improved admin UI, and uninstall cleanup.

== License ==

This plugin is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This plugin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this plugin. If not, see <https://www.gnu.org/licenses/>.