=== Sidrena Cijena & Cjenik for WooCommerce ===
Contributors: catcodestudio
Tags: sidrena cijena, cjenik, croatia, price list, 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

Croatian price rules for WooCommerce: the anchor price (sidrena cijena) next to every price and the daily CSV/XML price list (cjenik) by 08:00.

== Description ==

Two decisions of the Croatian Government (Narodne novine 101/2026, applied from 17 November 2026 as amended in Narodne novine 110/2026) oblige every trader with a web site to:

1. show, next to every retail price, the **additional ("anchor") price** — the regular retail price the product had on **10 September 2026**, without any sale (Odluka o isticanju dodatne cijene kao mjera izravne kontrole cijena);
2. publish on the web site a **machine-readable price list** in .csv or .xml, updated **every day by 08:00**, and keep every published list available for **30 days** (Odluka o objavi cjenika proizvoda i usluga kao mjera izravne kontrole cijena).

The plugin does both for a WooCommerce shop.

= Anchor price next to the price =

* An anchor price and date for every product and every variation (product editor, Price section).
* Shown under the price on the product page, for the selected variation, and in every listing — shop, categories, search, related products, product blocks. Variable products show the range.
* The Ministry's recommended wording by default: **"Cijena na 10.09.2026.: 19,99 €"** — or your own text with {date} and {price}. Shown even when it equals today's price, as the Ministry asks.
* Products first listed after 10.09.2026 get the price they are listed with as their anchor, dated that day — automatically.
* Food, drinks, cosmetics, cleaning products, toiletries and household products of traders bound since 2025 keep 02.05.2025: set the date per product.
* Follows the shop's tax display, like the price next to it.
* "Fill the empty anchors" from the current regular price — only after you confirm the price has not changed since 10.09.2026.
* Shortcode [sidrena_cijena] for page builders.

= The daily price list =

* CSV and XML with the data the decision lists: name, code (SKU), brand, unit of measure, price per unit, retail price, special form of sale (DA/NE) and its name, anchor price, barcode, availability (dostupno / nedostupno) — one row per simple product and per variation.
* File names as the Ministry's clarification prescribes: form of the outlet, address, designation, storage number, date and time — e.g. webshop_Ilica 150 Zagreb_WEB-01_12_17.11.2026_05:00.csv.
* Published every day at the time you choose; if WP-Cron sleeps, the first visit after that time publishes it, and the stable "latest" address generates it on the spot. For a server cron: wp sidrena-cjenik generate --if-missing.
* A 30-day archive (you choose how long, at least 31 days), a public list of all files, a stable address of the newest file for price-collecting programs, and a "Cjenik" page created with one click.
* Brand from WooCommerce Brands or an attribute, barcode from WooCommerce's GTIN/UPC/EAN/ISBN field or a meta key of your choice, availability from the stock.
* By default the way Croatian Excel opens it: semicolon, decimal comma, UTF-8 with BOM (comma and dot can be chosen). The XML always uses the decimal dot; dates everywhere are 10.09.2026.
* The CSV and the XML of one day and one outlet share the same storage number.
* The storefront shows "Cijena na …" on Croatian sites from the first day.


= What the decisions do not say =

Neither the decisions nor the Ministry prescribe column names, a delimiter or an XML schema — the plugin uses the words of the decision for the columns and keeps the same structure for every file. The anchor date column is an addition (it can be switched off).

= Not legal advice =

The plugin follows the decisions in Narodne novine 101/2026 and 110/2026 and the Ministry of Economy's clarification. It is a tool, not legal advice.

== Installation ==

1. Install and activate the plugin. WooCommerce must be active.
2. WooCommerce → Sidrena cijena: enter the address of the shop (it is part of the file name) and save.
3. Enter the anchor prices in the products, or use "Fill the empty anchors" if the regular prices have not changed since 10.09.2026.
4. Press "Publish the price list now" and "Create a Cjenik page", and link that page from the footer.

== Frequently Asked Questions ==

= What is the anchor price of a product that was on sale on 10.09.2026? =

The regular price before that sale — the decision speaks of the price "without special forms of sale".

= A product was added after 10.09.2026. =

Its anchor is the price it was first listed with, shown with that date. Products added after the plugin was installed get it automatically.

= My site gets no visits at night. Will the list be ready by 08:00? =

WP-Cron runs only on visits. The plugin also publishes on the first visit after the set time and whenever the "latest" address is fetched. For certainty, add a server cron with wp sidrena-cjenik generate --if-missing, or point an uptime monitor at the "latest" address.

= Where are the files? =

In wp-content/uploads/sidrena-cjenik/, as plain static files. The settings screen lists the public addresses.

== Changelog ==

= 1.0.0 =
* First release.
