=== ElállásiGomb – Online Elállás for WooCommerce ===
Contributors: bshhun
Tags: woocommerce, withdrawal, returns, refund, ecommerce
Requires at least: 6.5
Tested up to: 7.0
Requires PHP: 8.1
Stable tag: 1.0.0
WC requires at least: 8.0
WC tested up to: 10.9
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Adds a withdrawal button to WooCommerce orders and emails, linking to the hosted ElállásiGomb form pre-filled with the order data.

== Description ==

Hungarian webshops must provide an online withdrawal function under 45/2014. (II. 26.) Korm. rendelet, as amended by 415/2025. (XII. 23.) Korm. rendelet, which applies from 19 June 2026. The customer has to be able to declare withdrawal from the contract online, with a separate confirmation step and a timestamped acknowledgement of receipt on a durable medium.

This plugin is the WooCommerce connector for **ElállásiGomb**, a hosted service that provides that withdrawal flow. The plugin itself does not process withdrawals: it places a button in the customer's order view and in customer order emails, pointing at your ElállásiGomb form with the order data pre-filled, so the customer does not have to retype it.

= What the plugin does =

* Adds a withdrawal button below the order table in **My Account → Orders → order details**.
* Adds the same button as an action in the **orders list**.
* Adds the button to **customer order emails** (HTML and plain-text). It is never added to admin emails.
* Pre-fills the hosted form with the customer name, email address, order number, the first few product names and the order date.
* Lets you choose which **order statuses** show the button, and how long the **withdrawal window** stays open.
* Lets you customise the **button label**.

= How it works =

The button is a plain link. There is no server-to-server call, no REST API, no webhook and no API token. When the customer clicks it, they land on your hosted ElállásiGomb form with the fields already filled in.

The button only appears when the shop slug and URL are configured, the order status is one you allowed, and the order is still inside the withdrawal window.

= External service =

This plugin links to **ElállásiGomb** (https://elallasigomb.hu), a third-party service operated by Kovács László e.v. (Győr, Hungary). **A separate, paid ElállásiGomb subscription is required** for the button to lead anywhere useful; without an account there is nothing to link to. The service offers a free trial.

The plugin does not send any data from your server. However, when a customer clicks the button, their browser opens an ElállásiGomb URL that carries the following order data as query parameters:

* customer name (billing name)
* customer email address (billing email)
* order number
* the names of the first three products in the order
* the order date

Because the button is also placed in customer order emails, this URL — including the data above — is contained in emails sent to your customers. Consider this when assessing your own GDPR obligations: as the shop operator you are the data controller, and ElállásiGomb acts as a data processor.

Terms of service: https://elallasigomb.hu/aszf
Privacy policy: https://elallasigomb.hu/adatkezelesi-tajekoztato
Data processing terms: https://elallasigomb.hu/adatfeldolgozasi-feltetelek

= Disclaimer =

ElállásiGomb is a technical tool for providing an online withdrawal function. It is not legal advice. Compliance with the applicable legislation remains the responsibility of the webshop operator.

== Installation ==

1. Install the plugin through **Plugins → Add New**, or upload the `elallasigomb-online-elallas-for-woocommerce` folder to `/wp-content/plugins/`.
2. Activate the plugin. WooCommerce must be installed and active.
3. Go to **WooCommerce → Settings → ElállásiGomb**.
4. Enter your **shop slug**, which you can copy from the Embed page of your ElállásiGomb dashboard.
5. Leave the **ElállásiGomb URL** at its default unless you were given a different address.
6. Optionally adjust the withdrawal window, the order statuses and the button label, then save.

Until the shop slug and the URL are both set, the button stays hidden and an admin notice reminds you.

== Frequently Asked Questions ==

= Do I need an ElállásiGomb account? =

Yes. This plugin only builds the link; the withdrawal form, the acknowledgement of receipt and the case management live in the hosted service, which requires a paid subscription. A free trial is available.

= Does the plugin send my customers' data anywhere by itself? =

No. The plugin makes no outbound HTTP requests. Data only reaches ElállásiGomb when a customer clicks the button, and it travels in the URL their own browser opens.

= Why is the button not showing? =

Check that the shop slug and URL are set, that the order's status is one of the statuses you selected, and that the order is still within the withdrawal window. Setting the window to 0 shows the button regardless of age.

= Which date does the withdrawal window count from? =

The completion date, falling back to the payment date, falling back to the order creation date.

= Is it compatible with HPOS (High-Performance Order Storage)? =

Yes. The plugin declares HPOS compatibility and reads orders only through the WooCommerce CRUD getters, never directly from post meta.

= Can I change the button label? =

Yes, in WooCommerce → Settings → ElállásiGomb. The default in Hungarian is "Elállás a szerződéstől", matching the wording used by the decree.

== Screenshots ==

1. The connector settings under WooCommerce → Settings → ElállásiGomb.
2. The withdrawal button in the customer's order details view.
3. The withdrawal button in a customer order email.
4. The hosted ElállásiGomb form, pre-filled from the order.

== Changelog ==

= 1.0.0 =
* Initial release: settings tab with a shortcut from the Plugins screen, button in the My Account order view and in customer emails, query-parameter pre-fill, HPOS compatibility.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
