=== Livre Resolução para Lojas Online ===
Contributors: bonzinho
Tags: woocommerce, returns, right of withdrawal, refunds, gdpr
Requires at least: 6.2
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Adds the EU right-of-withdrawal return button (Directive 2023/2673) to WooCommerce, with a 2-step request flow, logging and email receipts.

== Description ==

**Livre Resolução para Lojas Online** adds to your store the right-of-withdrawal (return) mechanism required by **EU Directive 2023/2673**, which applies to distance and off-premises consumer contracts. It gives customers an unambiguous way to exercise their statutory right to withdraw from a purchase, and gives the shop owner a durable, logged record of every request.

**Note:** the customer-facing interface and the notification emails are written in European Portuguese (pt_PT), as the plugin targets stores selling to Portuguese/EU consumers.

Main features:

* **Shortcode** `[lreso_botao]` to place the button/form on any page or post. It supports three modes:
    * `modo="modal"` (default): shows only the button; clicking it opens the form in a modal.
    * `modo="inline"`: shows the form always visible.
    * `modo="link" url="/returns"` (or `pagina_id="123"`): the button links to another page.
    * Extra attributes: `texto` (button label), `title` (heading) and `order_ref` (pre-fills the order reference).
* **WooCommerce integration** with a "Livre Resolução" tab in the *My Account* area and an "Exercise right of withdrawal" button on each order detail (shown only within the legal deadline of 14 days).
* **Mandatory 2-step flow**: identification followed by an unambiguous confirmation screen.
* **Email notifications on a durable medium** (HTML) to both the customer and the administrator, including date/time and a summary of the submitted data.
* **Internal order note** on the WooCommerce order recording the request.
* **Admin panel** to customise the button label and colour, the email text and the display toggle.
* **Request log** stored in a dedicated table, with statuses (Pending, Processed, Rejected), search, filters and pagination.

Compatible with WooCommerce **HPOS** (High-Performance Order Storage).

== Installation ==

1. Copy the `livre-resolucao-para-lojas-online` folder to `/wp-content/plugins/`.
2. Activate the plugin from the WordPress "Plugins" menu.
3. Go to **Livre Resolução → Definições** to configure the button, the emails and the display options.
4. Place `[lreso_botao]` on a page, or leave the *My Account* option enabled.

== Frequently Asked Questions ==

= Does the plugin require WooCommerce? =

The shortcode works without WooCommerce. The order-related features (the *My Account* tab, the button on the order detail, the internal order note) require WooCommerce to be active.

= Where are the requests stored? =

In a dedicated table (`{prefix}lreso_solicitacoes`). You can review them under **Livre Resolução → Solicitações**.

= Is the deadline configurable? =

Yes, but it can never be shorter than the legal minimum of 14 days.

== Screenshots ==

1. The withdrawal request form on the storefront, with the legal notice and the customer's details.
2. Step 2: an unambiguous confirmation screen before the request is sent.
3. Success message shown after the request is registered and the email receipt is sent.

== Changelog ==

= 1.0.2 =
* Review hardening: unique `lreso` prefix across all classes, functions, options and hooks; removed the arbitrary custom CSS option; all CSS/JS enqueued correctly (no inline `<style>` in templates); prepared statements use the `%i` identifier placeholder.

= 1.0.0 =
* Initial version.

== Upgrade Notice ==

= 1.0.2 =
Compliance and code-quality improvements for the WordPress.org review.
