=== Omnibus Price History for WooCommerce ===
Contributors: catcodestudio
Tags: omnibus, lowest price, price history, eu directive, woocommerce
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Shows the lowest price of the 30 days before every discount, as the EU Omnibus Directive requires, from a log of every price change.

== Description ==

Since 28 May 2022 every shop that sells to consumers in the European Union has to show, next to any price reduction it announces, the **prior price**: the lowest price it applied during at least the 30 days before the reduction. This is Article 6a of Directive 98/6/EC, added by the "Omnibus" Directive (EU) 2019/2161, and it applies to a crossed-out price in a category listing just as much as to the product page.

The plugin keeps a log of every price your products and variations had, and when a sale starts it works out that prior price from the log and shows it under the price:

> Lowest price in the 30 days before the discount: €49.00

= What it does =

* **Records every price change** — the product editor, quick edit, bulk edit, the REST API, CSV imports and scheduled sales — for simple products and for every variation. One small table of its own; nothing is stored in orders.
* **Takes a first snapshot** of all prices when you activate it, in the background, so the 30-day window has a starting point from day one.
* **Freezes the prior price when a reduction starts** and keeps it for the whole sale, as the Commission Guidance allows. It does not slide the window into the sale itself, so the sale price never ends up shown as the "prior" one.
* **Counts earlier reductions too.** If the product was cheaper in another sale two weeks ago, that is the prior price — the Guidance is explicit that leaving it out is a breach.
* **Treats a deeper step of a running sale as a new reduction**, with the previous sale price inside its window — the plain reading of Article 6a.
* **Shows the note on the product page, for the selected variation and in listings** (shop, categories, search, related products, product blocks). Variable products in listings get "from" the lowest prior price among their reduced variations.
* **Moves the history over from "Omnibus — show the lowest price"** (both its storage formats), so switching does not restart the 30-day clock. That plugin's data is only read.
* A shortcode, `[ccoph_prior_price]` or `[ccoph_prior_price id="123"]`, for page builders and custom templates.
* Your own wording with `{days}` and `{price}`, or the translated default.
* The product editor shows the frozen prior price, when the reduction started and whether the log covers the whole period.
* Polish, German and Romanian translations included.


= Not legal advice =

The plugin applies Article 6a of Directive 98/6/EC as amended by Directive (EU) 2019/2161, read with the Commission Guidance on its interpretation (2021/C 526/02). National laws differ in the details — check the rules of the countries you sell to.

== Installation ==

1. Install and activate the plugin. WooCommerce must be active.
2. The first snapshot of all prices starts by itself in the background.
3. If you used "Omnibus — show the lowest price", open WooCommerce → Omnibus and press "Import the history".
4. That is all: the note appears under every reduced price.

== Frequently Asked Questions ==

= The plugin was installed while a sale was already running. What is shown? =

The plugin cannot know prices from before it was installed. For such a sale it shows the regular price as the prior price (the best evidence available) and marks it in the product editor — or shows nothing, if you choose so in the settings. Import the history of the previous plugin to fix it properly. Every sale started after installation has real history behind it.

= Is the regular price the same as the prior price? =

Only if the price did not change in the 30 days before the sale. If the regular price was raised shortly before the sale, or there was another sale in those 30 days, the prior price is lower than the crossed-out one — and that is the one the law asks you to show.

= Does it work with the block editor, block themes and the product blocks? =

The note is added to the product's price HTML, which the classic templates, the product blocks and most page builders print. Where a builder prints the price its own way, use the shortcode.

= Loyalty discounts and personal coupons? =

Article 6a does not apply to loyalty programmes and truly personalised reductions (Guidance, section 2.3). The plugin works with the product's own regular and sale price; coupons are not "announcements" of the product price and are not tracked.

= Does it slow the shop down? =

A price is written only when it changes. On a product page the frozen prior price is read from the product's meta — no calculation on page views.

== Changelog ==

= 1.0.0 =
* First release: price log for products and variations, first snapshot, the prior price frozen at the start of each reduction, the note on product pages, variations and listings, import from "Omnibus — show the lowest price", shortcode, Polish, German and Romanian translations.
