=== Eniverse Withdrawal Form for WooCommerce ===
Contributors: eniversepl
Tags: woocommerce, withdrawal, consumer rights, eu directive, right of withdrawal
Requires at least: 6.2
Tested up to: 7.0
Requires PHP: 7.4
WC requires at least: 7.0
WC tested up to: 9.0
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A simple, zero-config contract withdrawal form for WooCommerce — fully compliant with EU Directive 2023/2673.

== Description ==

**Eniverse Withdrawal Form for WooCommerce** enables your customers to exercise their right to withdraw from a contract in compliance with [EU Directive 2023/2673](https://eur-lex.europa.eu/eli/dir/2023/2673), effective from 19 June 2026.

The directive requires every online store selling to EU consumers to provide a clearly labeled, easy-to-find withdrawal mechanism. This plugin does exactly that — with zero configuration needed after activation.

= How it works =

**For logged-in customers:**
A "Withdraw from contract" button appears on the order list and order detail pages inside My Account. Clicking it opens a pre-filled form with the customer's name, order number, and email (locked fields). The customer selects which products to return, optionally provides a reason, reviews a summary, and confirms with a single click.

**For guest customers:**
A dedicated page is created automatically at activation. Guests enter their order number and email for verification, then follow the same flow. A direct link with a security token is also included in the WooCommerce order confirmation email, allowing one-click access.

= Key features =

* **"Withdraw from contract" button** in My Account → Orders and Order Details
* **Dedicated guest page** created automatically — no shortcodes or setup needed
* **Two-step confirmation** (form → summary → confirm) per Directive recital 37
* **Secure email link** with one-time token in order confirmation emails
* **Product selection** with checkboxes and quantity fields for partial withdrawals
* **Status system** — New → In progress → Accepted → Completed / Rejected
* **Automatic emails** — confirmation to customer, notification to admin, updates on every status change
* **"Withdrawals" tab** in WooCommerce admin with badge counter for new requests
* **Order integration** — metabox in order details, status column in order list, automatic order notes
* **Auto-refund** — changing status to "Completed" automatically creates a WooCommerce refund
* **Configurable withdrawal period** — default 14 days, adjustable in settings
* **HPOS compatible** — works with WooCommerce High-Performance Order Storage
* **Translation ready** — all strings internationalized, Polish translation included

= EU Directive 2023/2673 compliance =

* Button labeled "Withdraw from contract" / "Withdraw from contract here" as required
* Final confirmation button labeled "Confirm contract withdrawal"
* Two-step confirmation process (recital 37 — double-click requirement)
* Immediate email confirmation with date, time, and full content of the withdrawal statement
* Withdrawal function available throughout the entire statutory withdrawal period
* Disabled button with tooltip after period expiry (button remains visible)

= Who is this for? =

Any WooCommerce store selling to consumers in the European Union. The directive applies regardless of where your business is based — if you target EU consumers, compliance is mandatory from 19 June 2026 with no transition period.

== Installation ==

1. Upload the `eniverse-withdrawal-form-for-woocommerce` folder to `/wp-content/plugins/`
2. Activate the plugin through the **Plugins** menu in WordPress
3. Done — the withdrawal page and buttons are active immediately with no configuration

Optionally, visit **WooCommerce → Withdrawals → Settings** to adjust the withdrawal period (default: 14 days).

== Frequently Asked Questions ==

= Does this plugin require any configuration? =

No. It works out of the box. A dedicated withdrawal page is created automatically on activation, and the "Withdraw from contract" button appears in My Account for eligible orders. You can optionally adjust the withdrawal period in WooCommerce → Withdrawals → Settings.

= When does the withdrawal button appear? =

The button appears for orders with status "Processing" or "Completed", within the configured withdrawal period (default 14 days from delivery). After the period expires, the button remains visible but is disabled with a tooltip explaining that the deadline has passed.

= How does the guest form work? =

A page titled "Submit a return" is created automatically. Guest customers enter their order number and email address. The plugin validates the pair and, if correct, loads the product list. A pre-filled link with a security token is also added to the WooCommerce order confirmation email for one-click access.

= What happens when I change the status to "Completed"? =

The plugin automatically creates a WooCommerce refund for the selected products and amounts, changes the order status to "Refunded", and adds a note to the order. A confirmation email is also sent to the customer.

= Is this plugin HPOS compatible? =

Yes. The plugin fully supports WooCommerce High-Performance Order Storage (custom order tables). It declares HPOS compatibility and uses only order object methods for all meta operations.

= Can I translate this plugin? =

Yes. All strings are internationalized using WordPress i18n functions. A Polish translation is included. You can add your own translations using the provided `.pot` file in the `/languages` directory, or use a plugin like Loco Translate.

= Does this handle the physical return of goods? =

No. This plugin handles the legal act of withdrawing from a contract (the customer's statement). Physical return logistics and payment refunds are handled through WooCommerce's built-in functionality. The plugin creates the WooCommerce refund record automatically when you mark a withdrawal as "Completed".

= What statuses are available? =

* **New** — just submitted, awaiting review
* **In progress** — under review by the store
* **Accepted** — withdrawal accepted, awaiting return of goods
* **Completed** — goods received, refund issued (triggers auto-refund)
* **Rejected** — withdrawal rejected

== Screenshots ==

1. "Withdraw from contract" button on the My Account orders list
2. Withdrawal form with product selection and quantity fields
3. Summary view with "Confirm contract withdrawal" button
4. Guest withdrawal form with order verification
5. Admin — Withdrawals list with status badges
6. Admin — Single withdrawal details with status management
7. Admin — Withdrawal metabox in order details
8. Withdrawal link in order confirmation email

== Changelog ==

= 1.0.0 =
* Initial release
* Two-step withdrawal form for logged-in and guest customers
* EU Directive 2023/2673 compliant button labels and flow
* Automatic page creation on activation
* Secure token-based email links
* Product selection with quantity fields
* Status management system (New → In progress → Accepted → Completed / Rejected)
* Email notifications on submission and status changes
* Admin panel with withdrawal list, order metabox, and order list column
* Automatic WooCommerce refund on "Completed" status
* Configurable withdrawal period
* HPOS compatibility
* Polish translation included

== Upgrade Notice ==

= 1.0.0 =
Initial release. Install before 19 June 2026 to comply with EU Directive 2023/2673.
