=== Askoweb Order Withdrawal Control ===
Contributors: askowebde
Tags: withdrawal button, widerrufsbutton, woocommerce withdrawal, widerruf, revocation
Requires at least: 5.6
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.0.0
WC requires at least: 5.0
WC tested up to: 9.8
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

WooCommerce withdrawal button for EU shops – two-step order verification, automatic email confirmations, PDF export, and withdrawal statistics.

== Description ==

**Askoweb Order Withdrawal Control** adds a WooCommerce withdrawal button (Widerrufsbutton) to your online shop. Customers can declare a withdrawal directly from your website through a structured two-step process with order verification, email confirmation, and PDF document generation. Built for the EU withdrawal law requirements, including the German Buttonlösung (§ 312k BGB).

This free version is **fully functional** and does not require a license key or paid upgrade to work. Every feature listed below works out of the box.

= Why You Need a Withdrawal Button =

Since July 2025, several EU member states require online shops to provide a dedicated withdrawal function. Germany's § 312k BGB ("Buttonlösung") mandates that shops offer customers an accessible way to declare withdrawals online. This plugin provides that technical implementation.

This plugin is a technical tool, not legal advice. Consult a qualified professional for your specific obligations.

= How It Works =

1. **Customer clicks the withdrawal button** in your site footer.
2. **Order verification** – the customer enters order number and email. The plugin validates the order, checks the email, and confirms the withdrawal period is still active.
3. **Withdrawal confirmation** – the customer sees the order summary, selects items for full or partial withdrawal, and confirms with a declaration checkbox.
4. **Done** – confirmation email with date and time is sent immediately. A PDF is generated for download. The admin is notified and can manage the request from the dashboard.

= Features =

* **Two-step verification** – order number and email validation before any withdrawal is accepted
* **Full and partial withdrawal** – withdraw entire orders or select individual items with specific quantities
* **PDF confirmation** – generated automatically with full UTF-8 support, available to customer and admin
* **Email notifications** – customisable confirmation and notification emails with WYSIWYG editor and placeholder support
* **Footer button** – placed next to an existing footer link via CSS selector
* **Configurable withdrawal period** – estimated delivery days + withdrawal days (default: 3 + 14)
* **Customisable form texts** – modal title, labels, placeholders, confirmation text, success message
* **Sealed goods notice** – configurable notice for products affected by unsealing
* **Statistics dashboard** – withdrawal rate, partial vs. full, trends, bulk actions
* **WooCommerce orders integration** – optional filter and status column
* **HPOS compatible** – works with WooCommerce High-Performance Order Storage
* **WooCommerce Germanized compatible**
* **No external dependencies** – built-in PDF generator (also supports mPDF, TCPDF, DomPDF if available)
* **Translation-ready** – complete German translation included, extensible via .po/.mo
* **Clean uninstall** – optional removal of all database tables, options, and PDF files

= Free Version vs. Pro Version =

This free version covers the entire withdrawal workflow without restrictions:

* Footer withdrawal button with CSS selector placement
* Two-step verification (order number + email)
* Full and partial withdrawal with per-item quantity selection
* Email notifications with template editor and placeholders
* PDF withdrawal confirmation with customer download
* Statistics dashboard with bulk actions
* Configurable withdrawal period and sealed goods notice
* Customisable form texts and labels
* WooCommerce orders filter and column
* HPOS support and WooCommerce Germanized compatibility
* Complete German translation

The **[Pro version](https://askoweb.de/shop/withdrawal-button-for-shops/)** is a separate plugin with additional placement options and shop customisation:

* Floating widget with hover-expand animation
* Dedicated page and shortcode placement
* WooCommerce My Account menu integration
* Full button appearance customisation (colours, font sizes, background)
* Product exclusion rules (categories, tags, keywords)
* Automatic updates and priority support

The Pro version is hosted separately on [askoweb.de](https://askoweb.de/shop/withdrawal-button-for-shops/) and is not included in or required by this free plugin.

= Languages =

* English (default)
* German / Deutsch (complete translation included)
* Additional languages via .po/.mo files or translate.wordpress.org

== Installation ==

= Automatic =

1. Go to **Plugins > Add New** in your WordPress admin.
2. Search for **"Askoweb Order Withdrawal Control"**.
3. Click **Install Now**, then **Activate**.
4. Navigate to **WooCommerce > Withdrawal Button** to configure.

= Manual =

1. Upload the plugin folder to `/wp-content/plugins/`.
2. Activate through the **Plugins** menu.
3. Navigate to **WooCommerce > Withdrawal Button** to configure.

= Quick Start =

1. Enable the withdrawal button on the **Button Settings** tab.
2. Enter a CSS selector for an existing footer link. The withdrawal button is inserted next to it.
3. Set estimated delivery days and withdrawal period (default: 3 + 14 days).
4. Customise email templates on the **Email Settings** tab.
5. Place a test order and try the withdrawal from your shop frontend.

= Requirements =

* WordPress 5.6+
* PHP 7.4+
* WooCommerce 5.0+

== Frequently Asked Questions ==

= Does this plugin require WooCommerce? =

Yes. Without WooCommerce active, the plugin shows an admin notice and does not load.

= Does my shop need a withdrawal button? =

Several EU countries now require online shops to offer a dedicated withdrawal function. In Germany, § 312k BGB ("Buttonlösung") has been in effect since July 2025. Check with a legal professional whether your shop is affected.

= Where is the withdrawal button displayed? =

The free version places the withdrawal button as a link in your site footer, next to an existing element you specify via CSS selector.

The [Pro version](https://askoweb.de/shop/withdrawal-button-for-shops/) adds a floating widget, shortcode support, dedicated page placement, and WooCommerce My Account integration.

= How does the two-step verification work? =

**Step 1**: The customer enters order number and email. The plugin checks that the order exists, the email matches, the order has not already been fully withdrawn, and the withdrawal period is still active.

**Step 2**: The customer sees the order summary with items and prices. They select items for withdrawal, optionally add a reason, confirm the declaration, and submit.

= Can customers withdraw individual items? =

Yes. Customers select specific items and quantities. The PDF and emails reflect exactly which items were withdrawn.

= What happens after submission? =

The withdrawal is stored with "pending" status. A note is added to the WooCommerce order. The customer receives a confirmation email and can download a PDF. The admin receives a notification. Refund processing is handled separately by the shop admin through WooCommerce.

= Does the plugin process refunds automatically? =

No. This plugin handles the withdrawal declaration. Refunds are processed by the shop admin through WooCommerce.

= How is the withdrawal period calculated? =

**Order completion date + delivery days + withdrawal days**. With defaults (3 + 14), an order completed on January 1st has a deadline of January 18th. Both values are configurable.

= Does it work with HPOS? =

Yes. The plugin supports both traditional post-based order storage and WooCommerce High-Performance Order Storage.

= Is it compatible with WooCommerce Germanized? =

Yes. Fully compatible with WooCommerce Germanized and Germanized Pro.

= Can I customise the email templates? =

Yes. Both emails (customer confirmation and admin notification) support custom subject lines, WYSIWYG HTML body editor, placeholders (`{customer_name}`, `{order_number}`, `{order_date}`, `{revocation_date}`, `{reason_section}`, `{revoked_items}`, `{shop_name}`, etc.), custom sender details, and footer sections.

= Can I customise the withdrawal form? =

Yes. Modal title, field labels, placeholders, legal confirmation text, button labels, and the success message are all configurable from the Form Settings tab.

= Which PDF libraries are supported? =

The plugin uses mPDF, TCPDF, or DomPDF if available, and falls back to a built-in generator that requires no external libraries. Full UTF-8 support including German umlauts.

= Is the plugin translation-ready? =

Yes. All strings use WordPress i18n functions. German translation is included. Add other languages with Loco Translate, Poedit, or translate.wordpress.org.

= What data does the plugin store? =

Two custom database tables on your server: withdrawal requests (order data, customer data, items, status) and plugin settings. No data is sent externally.

= Can I remove all data on uninstall? =

Yes. Enable "Delete all data on uninstall" in settings. The plugin removes database tables, options, and PDF files on deletion.

= What is the difference between free and Pro? =

The free version is a complete withdrawal solution: footer button, two-step verification, emails, PDF, and statistics. The [Pro version](https://askoweb.de/shop/withdrawal-button-for-shops/) is a separate plugin adding floating widget, shortcode, My Account menu, appearance customisation, and product exclusion rules. A feature comparison is available in the Pro Version tab within plugin settings.

== Screenshots ==

1. **Footer button** – withdrawal link placed in the site footer alongside existing links.
2. **Order verification** – modal where the customer enters order number and email address.
3. **Withdrawal confirmation** – order summary with item selection, reason field, and declaration checkbox.
4. **Success screen** – confirmation with PDF download link.
5. **Admin dashboard** – withdrawal requests with status management, filters, and statistics.
6. **Button settings** – placement configuration and sealed goods notice.
7. **Email settings** – customer and admin email template editor with placeholders.
8. **Form settings** – customisable field labels, placeholders, and texts.
9. **PDF confirmation** – generated withdrawal document.
10. **Pro Version tab** – feature comparison between free and Pro version.

== Changelog ==

= 1.0.0 =
* Initial release.
* Two-step verification (order number + email).
* Full and partial withdrawal with per-item quantity selection.
* PDF generator with mPDF / TCPDF / DomPDF / native fallback.
* Customisable email notifications with placeholder support.
* Footer button placement via CSS selector.
* Configurable withdrawal period.
* Customisable form texts.
* Sealed goods notice.
* Statistics dashboard with trends and bulk actions.
* WooCommerce orders list filter and column.
* HPOS compatibility.
* German translation included.
* Clean uninstall with optional data removal.

== Upgrade Notice ==

= 1.0.0 =
Initial release. Fully functional WooCommerce withdrawal button with verification, email confirmations, and PDF export.

== External services ==

This plugin does not transmit any data to external servers. All withdrawal requests, customer data, and settings are stored exclusively in the local WordPress database on your own server.

= Askoweb.de – Pro Version link =

The plugin settings page includes a "Pro Version" tab with a link to the Pro Version on askoweb.de. This is a static HTML link only. No data is sent to askoweb.de at any time.

* Terms of service: https://askoweb.de/agb/
* Privacy policy: https://askoweb.de/datenschutzerklaerung/

== Privacy ==

= Data Collected =

This plugin stores data in two custom database tables on your server:

* **Withdrawal requests**: order ID, customer name, billing email, date and time, reason (optional), withdrawn items with quantities and prices, IP address, user-agent string
* **Plugin settings**: configuration values only (no personal data)

IP address and user-agent are recorded to document the withdrawal process. They are not shared externally and can be deleted from the admin dashboard.

= Data Sharing =

This plugin does **not** connect to any external service and does **not** send data to third parties. All data stays on your server.

= PDF Storage =

PDFs are stored in `wp-content/uploads/withdrawal-confirmations/` and protected via `.htaccess` (Apache) and `web.config` (IIS). Nginx users should add a `location` rule to block direct access.

= Data Retention =

All stored data can be reviewed and deleted through the WordPress admin. Enable "Delete all data on uninstall" to remove everything when the plugin is deleted.
