=== Orchestra Pop Lite ===
Contributors: carthub
Tags: woocommerce, discount, coupon, product page
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
Requires Plugins: woocommerce
WC requires at least: 8.0
WC tested up to: 9.5
Stable tag: 0.6.37
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

WooCommerce coupon offers on product pages: one campaign, whitelist, optional shortcodes. No external API.

== Description ==

Orchestra Pop Lite helps merchants surface WooCommerce coupons on the product page:

* **Coupon whitelist:** pick from coupons that are published, not expired, and under their global usage limit (invalid codes are hidden from the list).
* **Per-product intelligence:** WooCommerce rules decide which whitelisted codes apply to each product (categories / inclusions / exclusions).
* **One or more offers per product:** by default, if several codes could apply, the plugin shows only the strongest (when “sort strongest first” is on: percent before fixed, then amount). You can allow multiple stackable coupons (not “Individual use” in WooCommerce) so shoppers see and apply them together when rules overlap (e.g. category + product restrictions).
* **Custom savings line (optional):** leave empty for default WooCommerce-style text, or use placeholders `{percent}`, `{amount_raw}`, `{amount_html}`, `{code}`.
* **Presentation:** options for savings lines and showing codes to shoppers; floating quick guide (purple circle with white “?” opens a solid side panel) with contextual help; live campaign summary in admin.
* **Shortcodes:** `[orchestra_pop_lite_offer]` for the full offer box; `[orchestra_pop_lite_badge]` for the compact discount line only (title area). Both use the current product in context; optional `product_id="123"` when needed.
* **Targeting:** all products, selected categories, or specific product IDs — same campaign.
* **Apply:** no separate button — when the shopper adds the product with WooCommerce’s Add to cart, the plugin applies the same coupon(s) shown on the page (if rules allow). For percentage / fixed-product coupons, the box can show an estimated price after discount and a short line inviting Add to cart to activate the offer. If the code(s) are already on the cart, a short green confirmation appears with an estimated price when the coupon type allows it.
* **Placement:** on the default product template, move the offer box relative to title / Add to cart; the shortcode position in your builder is unchanged.
* **Shop badge (optional):** on catalog cards, short lead label plus strongest applicable discount (and a hint when several combinable coupons apply); Blocksy-friendly. Toggle off the extra savings text for label-only. Not for block-only product grids.
* **Title badge (optional):** on the default single-product template, compact discount line above the product name (WooCommerce hook priority 4); use `[orchestra_pop_lite_badge]` in builders when the title is outside the summary.
* **Lite stats:** aggregate counters in admin (add-to-cart applies and monthly orders with whitelisted coupons); stored in options only, resettable from settings.

**Premium (separate plugin)** adds multiple campaigns, reservation/urgency flows, branded design, analytics via the merchant portal, and licensed updates. See the in-plugin information card for a feature overview.

== Installation ==

1. Upload the plugin files to `/wp-content/plugins/orchestra-pop-lite`, or install the ZIP from Plugins → Add New.
2. Activate through the Plugins screen.
3. Ensure WooCommerce 8.0+ is active (WordPress will remind you if the dependency is missing).
4. Create coupons in WooCommerce → Marketing → Coupons (published).
5. Open **Orchestra Pop Lite** in the sidebar → tick the coupons to allow → turn the campaign on → set targeting (all / categories / product IDs) → adjust headlines and toggles → save.
6. On matching product pages, customers see the applicable offer(s); the discount is applied when they add the product to the cart (or they see a confirmation if the code is already active on the cart).

== Frequently Asked Questions ==

= Does this plugin phone home? =

No. The free version does not require calls to external servers to work.

= What about privacy and personal data? =

The plugin stores only configuration in your database (options). It does not log identifiable visitors. When shoppers apply the coupon, WooCommerce handles cart and checkout data as usual. A suggested paragraph for your privacy policy is available under **Settings → Privacy → Policy guide** after this plugin is active.

= Can I run this together with Orchestra Pop Premium? =

You can, but you may see two offer UIs if both output on the product page. Normally you should use only one.

= Where do updates come from? =

After the plugin is listed on WordPress.org, updates are delivered through the official WordPress update system (SVN). The Premium plugin is updated separately via the merchant portal.

== Screenshots ==

1. Campaign settings: activate campaign, coupon hints, and Premium upsell (Lite 0.6.x).
2. Campaign & placement: targeting, offer box position, title badge, and shortcodes.

== Privacy ==

* **Data stored:** Plugin options only (campaign settings, texts, allowed coupon codes list, optional aggregate counters). No separate customer database table.
* **External services:** None in the Lite version; no telemetry to Orchestra Pop servers.
* **Suggested policy text:** Registered with WordPress for the Privacy Policy guide (`wp_add_privacy_policy_content`). Merchants should still align with WooCommerce and their host/legal requirements.

For the WordPress.org plugin directory, prepare **banner**, **icon**, and **screenshot** images in SVN (not bundled inside the plugin ZIP). See [Plugin Assets](https://developer.wordpress.org/plugins/wordpress-org/plugin-assets/).

== Changelog ==

= 0.6.37 =
* Admin: Premium tab — annual subscription card displays €49 (VAT included) to match current checkout pricing.

= 0.6.36 =
* Admin: Premium marketing copy no longer mentions timed tokens (aligned with Orchestra Pop Premium coupon-centric defaults); margins tile and upsell strings updated accordingly.

= 0.6.35 =
* WordPress.org review: load shipped `.mo` paths via `plugin_dir_path()` (no `WP_PLUGIN_DIR` concatenation).
* WordPress.org review: remove custom `plugins_api` / “View details” override, manual update-cache refresh, and direct `update.php` include — rely on core Updates; admin strip now links to Dashboard → Updates only.

= 0.6.34 =
* Packaging: translation merge backups removed from `languages/`; internal doc wording adjusted so automated directory checks stay clean.

= 0.6.33 =
* WordPress.org readiness: no custom filters on core plugin update data; plugin-details helper renamed; readme **Tested up to** uses **major.minor** only (directory rule); “Check for updates” link keeps the current admin tab without unsafe `$_GET` handling.

= 0.6.32 =
* Readme: **Contributors** lists everyone who ships the plugin on WordPress.org.
* Admin: WooCommerce missing or outdated version — admin notice **only** on **Plugins → Installed Plugins** (not on every dashboard screen).

= 0.6.31 =
* Admin: Premium sidebar banner — border on image container; refreshed `gopremium.png` asset.

= 0.6.30 =
* Admin: Premium sidebar banner image set to `assets/images/gopremium.png` (full width, same corner radius).

= 0.6.29 =
* Admin — Premium tab pricing card uses the **WooCommerce currency symbol** (same approach as Orchestra Pop Premium), not a hard-coded euro sign.

= 0.6.28 =
* Readme / plugin card metadata: **Tested up to** included the **patch** level (6.9.4) so QA sites on WordPress 6.9.x did not show the “untested with your version” notice in the modal. **Superseded for wordpress.org listing** by 0.6.33 (directory expects major.minor only).

= 0.6.27 =
* Plugins screen: **View details** shows description, installation, FAQ, and changelog from the shipped readme, plus **Documentation and FAQ** (same idea as Orchestra Pop Premium).

= 0.6.26 =
* Admin: **Check for updates** in the top strip refreshes WordPress.org plugin data and shows a one-time result with links to **Dashboard → Updates** and **Plugins**.

= 0.6.25 =
* Main plugin file: stable snippet `OPOP_LITE_OFFICIAL_ID` so Orchestra Pop Premium can detect the official Lite package even if the install path differs.

= 0.6.24 =
* Plugin headers: **Author URI** → orchestrapop.com; **Plugin URI** unchanged (plugin subdomain) — required distinction for the plugin directory.

= 0.6.23 =
* Campaign sample products by category: use the WooCommerce product API instead of `get_posts` + `tax_query` (better for Plugin Check and for large catalogs).

= 0.6.22 =
* i18n: rely on WordPress 4.6+ automatic loading for the text domain; admin-only locale override still uses `load_textdomain()` where needed. Readme: short description within directory limits; **Tested up to** aligned with QA WordPress. Minor PHPCS / translator-comment cleanups.

= 0.6.21 =
* Admin — Premium subscription block: “Activate Premium license” string (translatable); default purchase URL `https://www.orchestrapop.com/#abbonamento` (`opop_lite_premium_purchase_url` filter unchanged). Stripe row uses `stripe.svg` beside the secure-payment label (Italian string in catalogs).

= 0.6.20 =
* Admin — subscription widget: simpler header (gradient + bottom border); Stripe wordmark removed from markup.

= 0.6.19 =
* Admin — subscription Stripe row: flat layout (flex + gap), no boxed frame.

= 0.6.18 =
* Admin — Premium tab: “margins” tile uses `control-panel.png` (replaces `controllo.png`); subscription card header colours and Stripe badge sizing. Added `assets/images/control-panel.png`.

= 0.6.17 =
* Admin — Premium tab: fourth feature tile (“Full control over margins”) — new teaser and expanded copy (budget caps, reservation, token routing); no media block. Removed “Visual preview coming soon” caption under placeholder images on other tiles.
* i18n: new strings for margins tile (5 languages).

= 0.6.16 =
* Admin — Premium tab: first three feature accordion panels show illustrative backgrounds on the media placeholder (`funnel.png`, `pickbrandcolor.png`, `multilayer-campaign.png` in `assets/images/`); fourth panel unchanged.
* Includes those PNG assets in the plugin package for consistent deploy/ZIP.

= 0.6.15 =
* Storefront: coupon code line styled as a compact white card; body copy unified to #222222 where not using the accent purple; removed the extra “apply hint” row under the offer; shorter estimated-price copy (with price placeholder) and matching cart-active line.
* i18n: new strings for the indicative price sentences (5 languages).

= 0.6.14 =
* Admin: Right column rail (`.opop-lite-layout__rail`) includes `min-height: 100%`; bump version so admin CSS cache refreshes (`?ver=`).

= 0.6.13 =
* Admin: Campaign summary (saved settings) moved out of the Premium upsell panel into its own block below it in the right column; summary area uses position sticky while scrolling.

= 0.6.12 =
* Admin: Campaign settings — native checkboxes for placement badge and all “What shoppers see” options; switch with Enabled/Disabled text kept only for “Activate campaign” and “Allow multiple stackable coupons” in the coupon section.

= 0.6.11 =
* Admin: Campaign settings — contextual Premium hints (tip + link) at the end of each main section: activation, coupons, campaign & placement, storefront display, and storefront preview.

= 0.6.10 =
* Admin: Campaign settings — live campaign summary moved to the sidebar under the Premium banner; aggregate statistics panel moved to the bottom of the page (after storefront preview). New aside aria-label for screen readers.

= 0.6.9 =
* Admin: Premium tab — Full stack and annual subscription side by side; Orchestrator AI roadmap note moved into full stack with crown mark (inline SVG, same path as premium `corona-tab.svg`); removed separate roadmap panel.

= 0.6.8 =
* Admin: Premium tab — removed hero panel; full-stack section new Italian copy + checkmark list; annual subscription widget (styles in admin.css, checkout link + Stripe row).

= 0.6.7 =
* Admin: settings sidebar upsell — replace bullet list with Italian promotional banner image (`assets/images/premium-sidebar-banner-it.png`), full width, 12px rounded corners.

= 0.6.6 =
* Admin: Premium tile icons — resolve `graph|branding|multicampagna|controllo` in `assets/images/` with case-insensitive stem; accept `.png`, `.webp`, `.jpg`/`.jpeg` (no strict exact filename match).

= 0.6.5 =
* Admin: Premium tile icons — optional `assets/images/*.png` only if file exists (no shipped raster placeholders); otherwise inline SVG. Removed icon image frame CSS. Drop stale `graph/branding/multicampagna/controllo` PNG/SVG placeholders to avoid “purple square” confusion.

= 0.6.4 =
* Admin: Premium tab tile icons default to bundled SVG in `assets/images/` (`graph.svg`, `branding.svg`, `multicampagna.svg`, `controllo.svg`); PNG filenames remain allowed as fallback.

= 0.6.3 =
* Admin: Premium tab tile icons — HTTPS URL when site uses HTTPS; framed icon area (background + border) so light/transparent assets remain visible; replaces near-invisible placeholder fills.

= 0.6.2 =
* Admin: Premium tab — feature tiles use PNG icons in `assets/images/` (graph, branding, multicampagna, controllo); accordion trigger padding adjusted.

= 0.6.1 =
* Admin: Premium tab copy refresh — hero headline/kicker/lead; “Multiple campaigns” tile; removed Lite vs Premium compare; added Premium full-stack list + “Coming soon” AI Orchestrator callout; pricing card shows full-stack line + richer visual shell.

= 0.6.0 =
* Admin: Premium tab redesigned — 3-column feature grid with exclusive accordion (SVG icons, expandable copy, placeholder for future GIFs), Lite vs Premium comparison, annual pricing card (€49 VAT included, full stack), primary CTA to purchase URL (filterable). New `class-opop-lite-admin-premium-tab.php`; filters `opop_lite_premium_purchase_url`, `opop_lite_show_premium_price_card`.

= 0.5.4 =
* Admin: removed extra bottom padding on the campaign form (sticky save bar may overlap the last panels when scrolled to the end — intentional trade-off).

= 0.5.3 =
* Admin: Premium sidebar — separator above “full overview” link; pull-quote slogan without quotation marks, larger italic type; language selector spacing and select chrome. Removed redundant “How it works” panel (covered by the floating guide).

= 0.5.2 =
* Admin: Premium sidebar — clearer copy for the per-product discount cap bullet (limit you set, not billing surprises).

= 0.5.1 =
* Admin: Premium sidebar — same SVG icon as the WP menu entry, “Go Premium!” title, pull-quote style slogan, benefit list with accent checkmarks (accent titles + neutral subtitles).

= 0.5.0 =
* Admin: tab navigation — Campaign settings and Orchestra Pop Premium; Premium tab is a full in-admin overview with honest upsell copy.
* Admin: right column (sidebar) Premium hook — lead + benefit bullets + link to Premium tab + external CTA to orchestrapop.com.

= 0.4.9 =
* Admin: removed redundant intro paragraph above the Storefront preview shortcodes (placement/apply behaviour is covered elsewhere).

= 0.4.8 =
* Admin: sticky bar — Save on the left, section anchor links on the right; lighter link weight. Italian UI: “Coupons” label uses “Coupon” (not “Buoni”).

= 0.4.7 =
* Admin: clearer campaign activation copy (activate campaign + show storefront widget); toggle states use “Enabled” / “Disabled” instead of “On” / “Off” (gettext + catalogs).
* Admin: sticky bottom “pill” bar with Save and in-page anchor links to Summary, Activation, Coupons, Placement, Display, and Preview.

= 0.4.6 =
* i18n: default storefront copy (headline, catalog badge label, legacy CTA) is stored empty when unchanged; resolved at runtime with gettext so it follows the **site** language on the storefront and the **admin UI language** (including the per-screen selector) in settings. Admin fields show translated placeholders when empty. One-time migration clears legacy English defaults saved in the option on first load.

= 0.4.5 =
* Fix: admin language selector now loads the plugin’s own `.mo` files directly. WordPress `switch_to_locale()` only allows locales installed under `wp-content/languages`, so Italian/German/French/Spanish from the plugin package were previously ignored (UI stayed English).

= 0.4.4 =
* i18n: shipped `.mo` catalogs for `en_US`, `it_IT`, `de_DE`, `fr_FR`, `es_ES` (storefront follows site language; admin follows WordPress user/site language).
* Admin: optional per-user override for the Lite settings screen only — language selector with globe icon under the header logo; stored in user meta (`opop_lite_admin_ui_locale`).

= 0.4.3 =
* Storefront: catalog badge — `padding: 10px`, column layout with centered text; percentage display without useless decimals (`10` not `10.00`); compact lines include winning coupon code in parentheses; `{percent}` in custom savings template uses the same percent formatting.

= 0.4.2 =
* Storefront: richer catalog badge (lead label + best applicable discount, custom savings template when enabled, combinable stack hint); toggle “Include discount hint on catalog badge”.
* PDP: optional compact badge above product title (default WC layout); campaign toggle; shortcode `[orchestra_pop_lite_badge]` for page builders; shared “first output wins” if hook and shortcode both exist.
* Coupon handler: `get_compact_discount_summary_for_code`, `get_combinable_stack_suffix` for badge copy without cart-centric wording.

= 0.4.1 =
* Storefront: archive badge compatibility with Blocksy — output via `blocksy:woocommerce:product-card:badges` so the label appears with image badges (not only when the title layer runs). Single output per product when both paths apply. CSS: base `.opop-lite-archive-badge` for any placement.

= 0.4.0 =
* Campaign: PDP placement (before/after title or Add to cart on default WC template); optional shop/category/tag archive badge with custom label (classic loop); aggregate statistics (apply-on-cart + monthly orders with whitelisted coupons), reset + privacy guide text; admin styling for stats panel.

= 0.3.7 =
* Admin: guide drawer — active answer block (`.opop-lite-guide-item--toc-active`) uses neutral panel background `#f9f8fc` (`--op-bg-panel` on the floating panel); design tokens on `.opop-lite-guide-panel` so variables resolve outside the main settings wrap.

= 0.3.6 =
* Storefront: do not show the green “discount already on cart” state when the cart is empty; refresh the offer box via AJAX after WooCommerce cart/coupon events (`added_to_cart`, `removed_from_cart`, `wc_fragments_refreshed`, cart totals update, coupon applied/removed) so the PDP does not stay stale without a full page reload.

= 0.3.5 =
* Storefront: removed the apply button; discounts are applied on WooCommerce Add to cart via `woocommerce_add_to_cart`. Banner shows a clear hint and an estimated post-discount unit price when calculable (percent / fixed product). Admin preview matches (no button). Legacy “Button label” setting kept but not displayed.

= 0.3.4 =
* PDP apply: auto-add simple (and variation / variable-with-defaults) products to the cart before applying coupons, avoiding “not applicable to cart” errors when the cart was empty; clearer errors for external/grouped/variable-without-defaults; decode HTML entities in WooCommerce error notices shown in the widget.

= 0.3.3 =
* Admin: guide FAB solid purple (#6a2dce) with white “?” icon; guide drawer — light vertical divider between TOC and answers, selected answer block lightly accented; overlap alert with “!” icon; campaign summary line uses the requested alert wording.

= 0.3.2 =
* Admin guide: floating button uses a purple “?” SVG (accent); guide drawer is solid white with a higher z-index above WP admin chrome; guide TOC is sticky while scrolling.

= 0.3.1 =
* Admin: campaign activation section (toggle) separate from placement; live summary panel; coupon overlap notice with optional “multiple stackable coupons”; renamed “What shoppers see” options with clearer copy.
* Storefront: optional multiple stackable offers (non–individual-use coupons only); AJAX applies several codes in one action.
* Floating guide (purple #6a2dce FAB, white “?” icon) opens a solid white side drawer; TOC vs answers separated by a light vertical rule; contextual ? links jump into the drawer; sticky table of contents.
* Shortcode `[orchestra_pop_lite_offer]` (default) plus optional `product_id` for layouts without product context; preview section shows copy + example.
* Form panel spacing fixed inside the save form.

= 0.3.0 =
* One winning coupon per product page (no multi-select UI on the storefront).
* Hide expired or globally exhausted coupons from the admin whitelist.
* Optional custom savings line with placeholders; improved AJAX success copy.
* When the discount is already on the cart: compact green message plus indicative price for this product when calculable.
* Admin: Orchestra Pop branding (sidebar SVG + header logo), Quick guide (TOC + contextual ? buttons), single-coupon preview.
* Removed “always use dropdown” option (obsolete with a single storefront offer).

= 0.2.1 =
* Admin: storefront toggles use visual switches (Orchestra-style) instead of checkboxes; preview well wider (32rem); headline/button styles aligned with storefront tokens.

= 0.2.0 =
* Admin: load published coupons from the site; multi-select whitelist with select-all / clear.
* Storefront: list or dropdown of applicable coupons per product (`WC_Coupon::is_valid_for_product`); AJAX applies the chosen code.
* Toggles: savings lines, public codes, sort strongest first, force dropdown.
* Floating contextual guide in admin; save logic preserves whitelist when the coupon list UI is not on the form.

= 0.1.3 =
* Fix: enqueue storefront CSS/JS using the main product ID (not `global $product`), so styles load on typical themes.
* Storefront rules scoped under `.woocommerce` + data attribute, with guarded `!important` where themes override buttons.
* Admin: label “Allowed coupon code (whitelist)” + copy explaining Lite has no separate list.
* Premium CTA → https://www.orchestrapop.com/ ; upsell card can no longer be dismissed.

= 0.1.2 =
* Admin UI aligned with Orchestra Pop premium shell (strip, panels, typography, accent buttons).
* Storefront box uses brand tokens (purple CTA, ghost background); more reliable JS click handling.

= 0.1.1 =
* Top-level admin menu with dedicated SVG icon (no longer under WooCommerce).
* Privacy Policy guide integration; readme Privacy section and FAQ.
* Plugin header: `Requires Plugins: woocommerce`; full GPLv2 license notice in main file; `LICENSE` file.
* Readme: `Requires Plugins` / WC tested headers for directory compatibility.

= 0.1.0 =
* Initial release.

== Upgrade Notice ==

= 0.3.0 =
Storefront now shows one offer per product; coupon list in admin hides invalid codes. Re-save settings if you relied on multiple offers or the old dropdown toggle.

= 0.2.1 =
Admin toggles are now switch controls; minor storefront/preview typography alignment.

= 0.2.0 =
Multi-coupon campaign with per-product filtering; open Lite settings to re-save and pick coupons from the list.

= 0.1.3 =
Fixes missing storefront styling; clearer coupon whitelist copy; Premium link updated.

= 0.1.2 =
Refined admin and storefront styling to match Orchestra Pop design language.

= 0.1.1 =
Admin menu moved to a top-level “Orchestra Pop Lite” item; privacy guide text added.
