=== PriceTale – Price History Chart for WooCommerce ===
Contributors: jyothismanoj
Tags: woocommerce, price history, price chart, price tracker, product price
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Show shoppers a "Price history" button next to every product price that opens a chart of each price rise and drop.

== Description ==

PriceTale adds a small **Price history** button under the price on every single product page. Clicking it opens a clean popup that shows how the product's price has changed over time – just like the price trackers shoppers already know from big marketplaces.

Being open about price changes builds trust: customers can see that a sale is a real sale, and that today's price is a good one.

= What shoppers see =

* A step chart of every price change, with green dots for drops and red dots for rises.
* Current, lowest and highest price, each with the date it happened.
* A badge such as "Lowest price ever" or "23% below its highest price".
* Time ranges (1M, 3M, 6M, 1Y, All) that appear once there is enough history.
* A list of the most recent price changes with the amount and percentage of each change.
* Fully responsive popup that works on phones, with keyboard and screen reader support.

= How it works =

* A new price point is saved automatically whenever a product's price changes – from the product editor, quick edit, bulk edit, imports, the REST API, or a scheduled sale starting or ending.
* For variable products, the chart follows the lowest variation price.
* Prices are formatted with your store's currency, separators and decimals.
* Past prices are filled in from your existing orders, so products that have sold before show history from day one.
* No settings, no external services, no tracking. Everything is stored in your own database.

== Installation ==

1. Make sure WooCommerce is installed and active.
2. Upload the `pricetale` folder to `/wp-content/plugins/`, or install the plugin from the Plugins screen in WordPress.
3. Activate the plugin through the **Plugins** screen.
4. Visit any product page – the **Price history** button appears under the price.

== Frequently Asked Questions ==

= Does it show price history from before the plugin was installed? =

Partly. WooCommerce does not keep past prices, but every order records what the customer paid. After activation, PriceTale reads your completed and processing orders once in the background and adds those prices as earlier points (the price before coupons, including tax if your store enters prices with tax).

Limits: only dates on which a product actually sold appear, so a price that changed and changed back without a sale in between is not shown. Variable products are skipped because their chart follows the cheapest variation, which orders can't tell. From activation onwards every price change is recorded exactly.

= Which product types are supported? =

Simple, external and variable products. For variable products the chart tracks the lowest variation price.

= Does it slow down my store? =

No. The chart script only loads on single product pages, and the price history is read from one product meta field.

= Is any data sent to third parties? =

No. The charting library (Chart.js) is bundled with the plugin and all data stays on your site.

= What happens to the data if I deactivate or delete the plugin? =

Nothing is lost. Price history can't be rebuilt once it is gone, so it stays in your database when the plugin is deactivated or deleted, and shows again when PriceTale is reinstalled.

To remove all stored price history when deleting the plugin, add `define( 'PHCHART_DELETE_DATA', true );` to wp-config.php first, then delete the plugin from the Plugins screen.

== Screenshots ==

1. The "Price history" button shown under the product price.
2. The price history popup with price stats, chart and recent changes.
3. Switching the chart to a shorter time range.
4. The popup on a mobile phone.

== Changelog ==

= 1.1.1 =
* Fixed: "Delete" on the Plugins screen could fail with "You cannot delete a plugin while it is active on the main site" when WordPress still listed PriceTale as active (for example a stale object cache). PriceTale now deactivates itself first, so Delete always works.

= 1.1.0 =
* New: past prices are imported once from existing orders, so products that have sold before show history from day one (simple and external products).
* Changed: price history is now kept when the plugin is deleted, so reinstalling brings it back. Define `PHCHART_DELETE_DATA` in wp-config.php to remove it on delete.
* Improved: clearer chart with visible axes, tick marks, dashed price grid lines and shorter price labels (e.g. "$3,500", or "$350k" on phones).

= 1.0.1 =
* Fixed: price boxes and the recent changes list no longer overflow or break numbers on small phones.
* Fixed: chart date labels no longer overlap on narrow screens.

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.1.1 =
Fixes "You cannot delete a plugin while it is active" when deleting PriceTale from the Plugins screen.

= 1.1.0 =
Fills in past prices from your existing orders, keeps price history when the plugin is deleted, and makes the chart axes clearer.

= 1.0.1 =
Fixes the price history popup layout on small phones.

= 1.0.0 =
Initial release.

== Third-party libraries ==

This plugin bundles Chart.js 4.6.1 (MIT License) – https://www.chartjs.org/
Source code: https://github.com/chartjs/Chart.js
