=== Diritto di Recesso for WooCommerce ===
Contributors: weblinksrlvarese
Tags: woocommerce, withdrawal, right of withdrawal, consumer rights, Italy
Requires at least: 5.8
Tested up to: 7.0
Stable tag: 1.0.0
Requires PHP: 7.4
WC requires at least: 6.0
WC tested up to: 9.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Adds the mandatory withdrawal button for Italian WooCommerce shops under art. 54-bis of the Consumer Code (D.Lgs. 209/2025).

== Description ==

From **June 19, 2026**, all Italian e-commerce stores selling to consumers (B2C) must provide a visible withdrawal button on the orders page, in compliance with art. 54-bis of the Italian Consumer Code (introduced by D.Lgs. 209/2025, implementing EU Directive 2023/2673).

This plugin adds to your WooCommerce shop:

* **"Withdraw from contract" button** on the "My Orders" page and on the order detail page
* **Guided two-step form**: the customer enters name, email and reason (optional), then confirms
* **Receipt email to the customer** with date, time and legal reference (durable medium)
* **Notification email to the administrator** with a direct link to the order
* **Back-office panel** listing all received requests (WooCommerce › Withdrawal Requests)
* **Fixed 14-day withdrawal window** (compliant with the legal minimum)
* Compatible with WooCommerce HPOS (High-Performance Order Storage)

= PRO Version =

The [PRO version](https://wordpress.weblink.it/prodotto/diritto-di-recesso-weblink/) adds:

* **Configurable withdrawal window** (e.g. 30 days for more generous policies)
* **Button color and label customization** from the back-office (with color picker)
* **Guest buyer support**: withdrawal link in the order confirmation email for customers who purchase without an account, with `[ddr_guest_lookup]` shortcode to retrieve the order via number + email
* **Request archiving**: "To handle" / "Archived" tabs to keep the back-office tidy
* **Remote license verification** with a 7-day offline grace period

= Legal Compliance =

The plugin is designed to meet the requirements of art. 54-bis of the Italian Consumer Code:

* The button is visible and accessible on the orders page
* The form collects the minimum required data
* The receipt email contains the date, time and reference to art. 54-bis (durable medium)
* The time window meets the 14-day legal minimum

**Note:** Information about the regulation is for guidance only and does not constitute legal advice. It is recommended to verify your shop's compliance with a qualified professional.

== Installation ==

1. Upload the `diritto-di-recesso` folder to the `/wp-content/plugins/` directory,
   or install the plugin directly from the WordPress "Plugins › Add New" screen.
2. Activate the plugin from the "Plugins" menu in WordPress.
3. Go to **WooCommerce › Withdrawal Settings** to configure the notification email and enabled order statuses.
4. Regenerate permalinks: **Settings › Permalinks › Save Changes** (required once after activation).

= Requirements =

* WordPress 5.8 or higher
* WooCommerce 6.0 or higher
* PHP 7.4 or higher

== Frequently Asked Questions ==

= When did the withdrawal button become mandatory? =

Art. 54-bis of the Italian Consumer Code, introduced by D.Lgs. 209/2025 implementing EU Directive 2023/2673, has been in force since **June 19, 2026**. All e-commerce stores selling to Italian consumers (B2C) must comply.

= Does the plugin work with any WooCommerce theme? =

Yes. The plugin integrates through WooCommerce native hooks and works with all themes compatible with WooCommerce 6.0 or higher on WordPress 5.8+.

= Can I change the withdrawal time window? =

In the free version the window is fixed at 14 days, which is the legal minimum under art. 54-bis. The [PRO version](https://wordpress.weblink.it/prodotto/diritto-di-recesso-weblink/) allows you to configure it freely (e.g. 30 days for a more generous policy).

= Does the plugin support guest buyers? =

Guest buyer support (withdrawal link in the order email + order lookup form) is available in the [PRO version](https://wordpress.weblink.it/prodotto/diritto-di-recesso-weblink/).

= Can I customize the button colors? =

Button color and label customization is available in the [PRO version](https://wordpress.weblink.it/prodotto/diritto-di-recesso-weblink/). In the free version the button has a predefined red style suitable for most themes.

= What happens when the customer clicks the button? =

The customer is redirected to a page in the account area where they find a two-step form. In the first step they enter name, email and reason (optional); in the second they see a summary and confirm. On submission: 1) the request is saved to the WooCommerce order; 2) the customer receives an email with date, time and legal note; 3) the administrator receives a notification with a link to the order.

= Is it compatible with WooCommerce HPOS? =

Yes, the plugin is compatible with WooCommerce High-Performance Order Storage (HPOS).

== Screenshots ==

1. "Withdraw from contract" button on the "My Orders" page
2. Withdrawal form — Step 1 (data and reason)
3. Withdrawal form — Step 2 (summary and confirmation)
4. Back-office panel with the list of received requests
5. Settings page with PRO version upsell

== Changelog ==

= 1.0.0 =
* Initial public release
* Withdrawal button on the orders page and order detail
* Guided two-step form
* Receipt email to the customer and notification to the administrator
* Back-office panel with request list
* Fixed 14-day withdrawal window (compliant with art. 54-bis)

== Upgrade Notice ==

= 1.0.0 =
Initial release of the plugin.
