=== Order Returns for WooCommerce ===
Contributors: nuke86
Tags: woocommerce, returns, reso, refund, my-account
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Adds a "Resi" (Returns) section to WooCommerce My Account. Customers can request returns within a configurable window.

== Description ==

**Order Returns for WooCommerce** adds a dedicated **Resi** (Returns) page inside the WooCommerce My Account area. Customers can browse their eligible orders, select one or more items to return, optionally provide a reason, and submit the request — all without leaving their account. Compatible with 2026 update of italian "art. 54-bis del Codice del Consumo".

= Features =

* New **Resi** endpoint in My Account navigation.
* Configurable return window (default: 14 days from order completion).
* Customers can select individual items within an order to return.
* Optional free-text field for the return reason.
* Order status automatically changes to **Richiesta Reso** (Return Requested) on submission.
* An order note is added to the order for shop managers.
* **Email notifications** sent to both the shop owner and the customer.
* Fully configurable via **WooCommerce → Settings → Resi**.
* Compatible with WooCommerce HPOS (High-Performance Order Storage).
* Template override support: copy `templates/myaccount/returns.php` to `yourtheme/woocommerce/myaccount/returns.php`.

= Settings =

All settings are found under **WooCommerce → Settings → Resi**:

* **Return window (days)** — how many days after order completion the customer can request a return (default: 14).
* **Eligible order statuses** — which order statuses are eligible (default: Completed).
* **Shop notification email** — the email address that receives return notifications (defaults to the WooCommerce store email).
* **Shop email subject** — customisable subject line with `{site_title}` and `{order_number}` placeholders.
* **Customer email subject** — customisable subject line with the same placeholders.

= Template Override =

Place a copy of `woocommerce/myaccount/returns.php` inside your active theme to fully customise the Returns page output without editing plugin files.

== Installation ==

1. Upload the `woocommerce-returns` folder to the `/wp-content/plugins/` directory, or install it directly from the **Plugins → Add New** screen.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Go to **Settings → Permalinks** and click **Save Changes** to flush rewrite rules (required the first time).
4. Configure the plugin under **WooCommerce → Settings → Resi**.

== Frequently Asked Questions ==

= Which WooCommerce version is required? =

WooCommerce 6.0 or later. The plugin is tested up to WooCommerce 9.x and declares HPOS compatibility.

= The "Resi" page redirects to the wrong page. =

Go to **Settings → Permalinks** and click **Save Changes** to regenerate WordPress rewrite rules. This is always needed after activating any plugin that registers a custom My Account endpoint.

= Can I change the number of return days per product or category? =

Not out of the box, but the plugin exposes the `wc_returns_settings` filter (on the settings fields array) and the `wc_returns_request_processed` action hook so developers can extend it.

= Does the plugin delete its data when uninstalled? =

Yes. Uninstalling the plugin via the WordPress dashboard removes all plugin options from the database. Order meta (`_wc_return_requested`, `_wc_return_requested_at`, `_wc_return_requested_items`, `_wc_return_reason`) is intentionally left on orders so shop managers retain a full history.

= Is it compatible with HPOS? =

Yes. The plugin declares `custom_order_tables` compatibility via `FeaturesUtil`.

== Screenshots ==

1. The "Resi" entry in the My Account navigation menu.
2. The Returns page listing eligible orders with per-item checkboxes.
3. The return request confirmation with order status changed to "Richiesta Reso".
4. The WooCommerce Settings → Resi configuration panel.

== Changelog ==

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.0.0 =
Initial release. No upgrade steps required.
