=== GARAN Tool – EU legal guarantee notice & GARAN label ===
Contributors: garantool
Tags: woocommerce, guarantee, warranty, eu, consumer law
Requires at least: 5.8
Tested up to: 6.9
Requires PHP: 7.4
WC requires at least: 6.0
WC tested up to: 10.2
Stable tag: 1.0.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Shows the official EU harmonised legal-guarantee notice and the EU GARAN durability-guarantee badge in your shop.

== Description ==

GARAN Tool helps EU shops meet the consumer-information requirements on guarantees:

* **Legal-guarantee notice** – a link that opens the official EU harmonised notice about the legal guarantee of conformity in a modal window, in the visitor's language.
* **GARAN badge** – the EU GARAN durability-guarantee label, shown next to a product when the producer's commercial guarantee exists in the GARAN database. When there is no match, nothing is shown (fail-safe).

The plugin loads the GARAN embed script (`https://garan.ro/embed/garan.js`, deferred) and, with WooCommerce, adds the link and the badge to single product pages. Variable products update the badge when the visitor selects a variation.

You can also configure automatic insertion rules (with a visual picker) in your GARAN account at https://garan.ro → My sites; those rules only need the script that this plugin loads.

Works without WooCommerce too: the script and the shortcodes are always available.

= Shortcodes =

* `[garan_notice]` – the legal-guarantee link. Attributes: `text` (link text), `lang` (two-letter language code, optional; otherwise the page language is used).
* `[garan_badge]` – the GARAN badge. Attributes: `brand`, `identifier` (model / SKU / GTIN), `country` (two-letter code, optional). Inside a product context, missing values are taken from the current product.

You can also write the markup by hand: `<a href="#garantieEu">…</a>` (or any element with the class `garan-notice-link`) and `<div class="garan-badge" data-brand="Bosch" data-identifier="WGG244Z0BY" data-country="RO"></div>`.

= Brand and identifier =

Brand (first non-empty value wins, starting with the chosen source): brand taxonomy (auto-detects `product_brand`, `pwb-brand`, `yith_product_brand`) → product attribute (default `brand`, also matches `pa_brand`) → fixed text.

Identifier: chosen source (SKU, product attribute such as `model`, or GTIN/EAN from the WooCommerce GTIN field or common meta keys `_ean`, `_gtin`, `hwp_product_gtin`, …) → SKU. Variations are checked before their parent product.

= Privacy =

The plugin makes no server-side HTTP requests. Visitors' browsers load the GARAN script from https://garan.ro.

== Installation ==

1. Upload the `garan-tool` folder to `/wp-content/plugins/`, or install the zip via Plugins → Add New → Upload Plugin.
2. Activate the plugin.
3. Go to Settings → GARAN Tool: choose your country, the positions on the product page and where the brand and identifier come from.
4. Optional: create a free account at https://garan.ro to configure automatic insertion rules for your site.

== Frequently Asked Questions ==

= The badge does not appear. =

The badge is only shown when the producer guarantee for that brand + identifier exists in the GARAN database. Check the "Test" line on the settings page to see which brand and identifier are sent for your latest product.

= My theme uses block templates and the link does not show. =

Add the `[garan_notice]` and `[garan_badge]` shortcodes (Shortcode block) to the single product template, or set up automatic rules in your GARAN account.

= Can I use it without WooCommerce? =

Yes. The script is loaded on every page and the shortcodes work anywhere; pass `brand` and `identifier` to `[garan_badge]`.

= Does it slow down my site? =

The script is small and loaded with `defer`, so it never blocks page rendering.

= Developers =

Filters: `garan_tool_load_script`, `garan_tool_origin`, `garan_tool_notice_text`, `garan_tool_brand_taxonomies`, `garan_tool_gtin_meta_keys`, `garan_tool_product_brand`, `garan_tool_product_identifier`, `garan_tool_badge_data`.

== Changelog ==

= 1.0.0 =
* First release: embed script, legal-guarantee link, GARAN badge on WooCommerce product pages (variation aware), shortcodes, settings page.
