APG Withdrawal for WooCommerce
Add to WooCommerce an online withdrawal workflow with customer form, My Account integration and admin request log.
Install in
APG Withdrawal for WooCommerce adds to your WooCommerce store a complete online right of withdrawal workflow compliant with EU consumer protection legislation.
Features
- Customer withdrawal form via the
[apg_withdrawal_form]shortcode. - Partial withdrawal down to the unit: the customer ticks the order lines and adjusts how many units of each one they are withdrawing from.
- Configurable withdrawal window (days) and deadline source (completed or created date).
- Optional extra grace days on top of the standard withdrawal window.
- Active request detection: hides the withdrawal button if a request is already open for the order.
- Optional digital-content waiver checkbox at checkout (both classic shortcode and block-based checkout): a single excluding selector chooses when to display it — never, on products classified as digital content, or on every order. Which products count is decided exclusively by the per-product / per-category “Withdrawal type”, never by whether the product is virtual or downloadable: the product’s own type is read first and, when it keeps the default
allowed, it is inherited from its categories with the most restrictive one winning. The customer’s choice is persisted to order meta as a structured log — the exact label shown, UTC timestamp, IP, user agent and checkout type — as legal evidence. - Admin request log with full request details (custom post type), status views with counts, bulk status changes and sortable status column.
- Own WooCommerce order status Withdrawal requested, optionally applied to the order as soon as a declaration is received, so affected orders can be filtered, sorted and bulk-edited with the native tools.
- Optional refund account (IBAN) validated with the international control digits (ISO 7064 MOD-97-10).
- Online contract termination function (Article 23 of the proposed Digital Fairness Act): a form of its own with the wording the article prescribes, available for as long as the contract lasts and with no deadline, and an acknowledgement of receipt stating the date on which the termination takes effect. Shipped switched off, with the
apg_withdrawal_termination_effective_datefilter for shops whose contracts end on a notice period or a billing cycle. - Optional double opt-in for guests: the request is held until the customer opens a single-use link sent to the email address on the order, while keeping the date and time of the original submission.
- Jurisdiction setting (EU baseline / Spain) that governs the statutory reference shown to the customer.
- REST API under
apg-withdrawal/v1to list, read, create and progress requests from headless storefronts and back-office integrations. - IP address and browser identifier storage options for legal evidence.
- Email notification to the store admin on every new request.
- Automatic customer acknowledgement email on submission.
- Customer status update emails when the request is accepted, rejected or completed.
- Automation: updates the withdrawal request status automatically when the linked WooCommerce order changes status.
- My Account integration: customers can view their withdrawal request history.
- CSV export of withdrawal requests, honouring the status currently selected in the list, with protection against spreadsheet formula injection.
- 100% compatible with HPOS (High-Performance Order Storage).
- Warning when WooCommerce 11.1’s own order withdrawal feature is switched on at the same time, so the shop never offers customers two unconnected forms.
- Public form built to WCAG 2.1 AA — the level EN 301 549 requires today — with the WCAG 2.2 target-size criterion already met: grouped and labelled controls, live regions for dynamic notices and focus moved to each new step.
- One-click WooCommerce refund built from the request: the declared lines and quantities, capped by whatever is still refundable on the order. Always started by hand, never automatically. Works with Redsys and Bizum out of the box.
- WPML and Polylang ready, both through
wpml-config.xmland through runtime string registration.
Translations
- English: by Art Project Group (default language).
- Spanish: by Art Project Group.
More information
You can learn more about APG Withdrawal for WooCommerce on our official website, and follow the development on GitHub.
You can also read the full documentation, with every setting explained one by one.
Thanks
Thanks to everyone who uses the plugin, helps improve it, makes a donation or encourages us with their comments.
If you find this plugin useful, you can support its development with a small donation.
External Services
This plugin connects to the WordPress.org Plugins API to fetch information about the plugin (such as the rating). It sends the plugin slug when requesting data. More information: https://wordpress.org/about/privacy/
Written by Joobi from the project's own listing. See the source page
0.9.0
- New online contract termination function, the one Article 23 of the proposed Digital Fairness Act will require: its own two-step form, the prescribed wording, and an acknowledgement stating the date the termination takes effect. Off by default.
- The digital-content waiver no longer loses its tick in the classic checkout when WooCommerce refreshes the order after an address, shipping or payment change.
- Guest confirmation by email now also governs contract terminations, so a shop that asks for it is asked for it everywhere.
- The notification announcing a new request to the shop carries the link to open it again, which it lost whenever the customer was the one sending the form.
- Compatibility with WooCommerce 11.3.1 verified.
0.8.1
- The links to the website, the documentation, the donation and the support now open in the language of whoever is looking at the screen.
0.8.0
- Contextual help on the settings screen and on the requests list, explaining every option without leaving them.
0.7.4
- A withdrawal request already on file is no longer registered a second time when the customer submits the form more than once.
- An order already withdrawn from in full no longer accepts further requests, whether for the whole order again or for some of its products.
- The anti-spam field no longer drags the page sideways on right-to-left sites (Arabic, Hebrew, Persian).
- Orders whose products are all excluded from the right of withdrawal no longer carry the withdrawal link in their emails, with a new
apg_withdrawal_show_order_linkfilter to override it. - Compatibility with WooCommerce 11.2.1 verified.
0.7.3
- The Withdrawal tab of My Account now opens with its own heading, like every other account section, instead of starting straight into a notice. New
apg_withdrawal_account_titlefilter to change it or remove it. - The form now loads its stylesheet when it is inserted with the shortcode in a widget or a block template, where it used to ask for a handle that only exists in the admin and came out unstyled.
- Compatibility with WooCommerce 11.1.2 verified.
0.7.2
- The public form no longer exposes other people’s orders: an email address in the page URL listed that customer’s purchase history, and an order number on its own showed the contents and the total of any order.
- Withdrawal requests move to WooCommerce’s order capabilities, so the Editor role can no longer read or change the consumer data they hold.
- The rate limiter can no longer be bypassed with a forged proxy header, and the review step now has a ceiling of its own.
- The review screen works again without JavaScript: it was printed through a filter that strips forms, leaving the customer nothing to submit.
- Quick Edit on a product category no longer resets its withdrawal type to “allowed”.
- The bulk-action and refund result notices are signed by the redirect that emits them and verified before being shown.
- Output escaping and nonce verification reworked: the plugin now ships with no security exceptions marked on its output.
- Warning when WooCommerce 11.1’s own order withdrawal feature is switched on at the same time, with a link to the screen where you turn it off, plus a new FAQ entry on what each of the two covers.
- Compatibility with WooCommerce 11.1 verified.
0.7.1
- Spanish translation reviewed against the wording approved on translate.wordpress.org: 27 strings corrected for terminology and current orthography — “artículo” in lower case as Spanish requires, “al finalizar la compra” instead of the anglicism “checkout”, “servicio de envío” instead of “mailer”, “solo” without the accent the RAE dropped. Since 0.6.1 the bundled translation takes precedence over the centralised language pack, so these corrections only reach the shop through a plugin update — which is what this release is for. The model withdrawal form of Annex I.B was deliberately left untouched, pending a check of its wording against Annex B of the TRLGDCU. No code changes.
0.7.0
- Partial withdrawal down to the unit. The “Specific products only” scope no longer works as an all-or-nothing selector per line: the form now renders one row per order line with a checkbox and a quantity input capped at the units originally ordered, so a customer who bought three units and is returning one declares exactly that. The units are stored in
_apg_withdrawal_quantities, travel through the confirmation screen, and are shown in the acknowledgement email, the request detail screen and the CSV export as “Product x 1 of 3”. They are also folded into the SHA-256 receipt hash asitem:unitspairs, so the digest covers the quantities and not just which lines were selected. Requests registered before this release keep working and are read as “all the units of the selected lines”, which is what they meant. - Withdrawal status workflow in the requests list. The post-status views (“All | Published”), which carried no meaning for this post type, are replaced with one link per withdrawal status showing its count, resolved in a single grouped query. The status column becomes sortable, a bulk action per status lets a batch of requests be moved through the workflow at once — going through
apg_withdrawal_change_status(), so each one still gets its log entry and, when enabled, its customer notification — and the Export CSV button now exports the status currently on screen instead of always the whole log. - Own WooCommerce order status
wc-apg-withdrawal(“Withdrawal requested”), registered for both the legacy and the HPOS storage, available in the order editor dropdown, in the orders list views, as a bulk action and inside the plugin’s own Automation mapping. A new setting, Order status when a request is received, optionally moves the linked order to any status — the new one or an existing one — as soon as a declaration is registered. Disabled by default, so updating changes nothing until you opt in. - Optional refund account (IBAN) on the public form, configurable as hidden (default), optional or required. The number is normalised, checked against the ISO 13616 structure and the ISO 7064 MOD-97-10 control digits before being accepted, and surfaces in the confirmation screen, the acknowledgement email, the request detail screen and the CSV export. It is exposed by the privacy exporter and, unlike the other personal fields, is deleted outright rather than redacted by the eraser: a placeholder in an IBAN field would read as a malformed account number, and the account has no evidentiary value for the declaration itself.
- Optional double opt-in for guest declarations. The public form already refuses any order whose billing email does not match the address typed by the visitor, but for a guest checkout that pair may be known to somebody other than the consumer. With Confirm guest requests by email? enabled, a submission from a visitor who is not logged in is parked server-side and a single-use link is emailed to the address on the order; only opening it registers the declaration. Critically, the moment that counts legally is the one at which the consumer sent the form, so the original timestamp travels inside the parked payload and becomes the request’s date and the timestamp covered by the receipt hash — the customer never loses days of their withdrawal period to their own inbox. Tokens are stored as SHA-256 digests, are single use and expire after 24 hours (filterable via
apg_withdrawal_verification_ttl). - Jurisdiction layer. A new Jurisdiction setting (
EUbaseline /ES) governs the statutory reference shown on the confirmation screen and in the acknowledgement email. Spain has not transposed Directive (EU) 2023/2673 yet, so both options currently apply the same requirements and the Spanish one additionally cites the TRLGDCU; the point of the layer is that every jurisdiction-specific branch goes throughapg_withdrawal_jurisdiction_supports(), so the national extras can be switched on in one place once they reach the BOE instead of being retrofitted across the codebase. Both the jurisdiction and the feature matrix are filterable. - REST API under the
apg-withdrawal/v1namespace.GET /requests(paginated, filterable by status and order),GET /requests/<id>andPUT /requests/<id>requiremanage_woocommerce;POST /requestsis public so decoupled storefronts can register a declaration, and routes through the very same processor as the public form — order/email match, rate limiting and, when enabled, guest email verification all apply, and a parked submission answers202withpending_verification. The refund account is only echoed back to a caller that can manage WooCommerce. A newapg_withdrawal_request_registeredaction fires once a declaration is fully registered. - Refund the customer straight from the withdrawal request. Each request gains a Refund panel that works out what the declaration implies — the declared lines at their declared quantities, plus the standard delivery cost when the withdrawal covers the whole contract, as Article 13(1) of Directive 2011/83/EU requires — and caps every figure by what is still refundable on the order, so a refund issued by hand beforehand can never be duplicated. Nothing is ever refunded automatically: the merchant presses the button, and by default the refund is only recorded in WooCommerce without moving money or touching stock, with opt-in checkboxes to push it through the payment gateway (offered only when the gateway supports refunds) and to restock. Creating it requires the same capability WooCommerce itself asks for to refund an order, writes an order note and is filterable through
apg_withdrawal_refund_plan. - Redsys and Bizum reach the refund panel with no extra integration, because those gateways implement the standard WooCommerce refund API and the panel drives that API. The panel now names the gateway it is about to use instead of talking about an anonymous “payment gateway”, spells out for Redsys and Bizum that partial refunds are accepted and that the customer’s bank takes 2 to 31 days to credit the money — the Article 13(1) deadline binds the trader issuing the refund, not the bank crediting it — and, when the active gateway cannot refund programmatically (the free Redsys Light edition, for instance), says so and records the refund without moving money. Gateway detection is filterable through
apg_withdrawal_gateway_info. - A refund the gateway refuses now surfaces the reason the gateway gave — the SIS code, for Redsys — instead of a generic failure notice.
- Fixed: the printable Annex I.B model form left nowhere to actually write. The minimum height sat on the field container, which the caption already filled, so each rule ended up flush under its own label. The writing space now belongs to the ruled lines themselves and each field gets as many as its answer needs — three for the description of the goods and for the consumer’s address, two for the signature, one for the dates and the name.
- Fixed: the Annex I.B page no longer opens the print dialog by itself. Auto-printing on load was both an unrequested context change and the root of a Safari bug where a cancelled print left the browser printing blank sheets from then on. Printing now always starts from the button, after the web fonts and one paint have settled. A repaint on
afterprint— and on the print media query ceasing to match, because Safari is inconsistent about which of the two it emits when the dialog is dismissed — also fixes the page being left blank after closing the dialog. The public form’s link is labelled “Open the model form” and announces that it opens in a new tab. - Annex I.B printing polish: A4 page box with 16 mm margins, and captions kept on the same sheet as their ruled lines.
- Accessibility pass on the public form, targeting WCAG 2.1 AA. The line-item selector is now a labelled
fieldsetof native checkboxes and number inputs instead of a multi-select widget, so it is operable with a keyboard and announceable by screen readers; the dynamic notices became live regions (role="alert"for the order error,role="status"for the product warning); and focus is moved to the newly injected content after every AJAX step, which previously left it on a button that no longer existed (3.2.2 and 4.1.3). The line rows are also spaced so they already satisfy the WCAG 2.2 target-size criterion (2.5.8), which is not part of WCAG 2.1 AA but arrives with version 4.1.1 of EN 301 549 — the standard the European Accessibility Act points to, and which has bound e-commerce since 28 June 2025. wpml-config.xmlshipped with the plugin, so WPML and Polylang pick up the six merchant-configurable strings and the withdrawal-type metas without any code running. The runtimewpml_register_single_stringregistration added in 0.6.0 stays in place for setups that read strings that way.- Declared compatibility with WooCommerce 11.0.
- New FAQ entries on the penalty regime for not offering the withdrawal function, the refund account, the guest double opt-in and the REST API.
0.6.1
- Bundled translation now takes precedence over the centralised language pack: when the plugin ships a
.mo(or.l10n.php) for the current locale under/languages, thelang_dir_for_domainfilter returns that folder unconditionally, instead of only falling back to it when WordPress could not find anything inwp-content/languages/plugins/. Result: the locale shipped by the plugin (currentlyes_ES) is always rendered with the strings packaged in the current release, so new wording and changelog-driven copy adjustments reach users on the same day as the plugin update without waiting for translate.wordpress.org to regenerate its language pack. Locales for which the plugin does not bundle a translation continue to be loaded from the centralised system pack as before.
0.6.0
- Fixed: the plugin’s bundled Spanish translation (and any future locale shipped under
/languages) was not being loaded on sites where translate.wordpress.org had not yet generated a language pack. WordPress’s just-in-time loader only inspectswp-content/languages/plugins/, so the.mofile shipped inside the plugin was ignored. The plugin now hooks the WordPress 6.6+lang_dir_for_domainfilter to return the bundled/languagesfolder when no language pack is available, without resorting to the WP.org-discouragedload_plugin_textdomain()call. On WordPress 6.5 and below the bundled translation will still not load until a language pack is published, but the plugin keeps working in the source language. - WooCommerce 10.9 transactional-email log integration: the three
WC_Emailclasses shipped by the plugin (customer acknowledgement, admin notification, status update) are picked up automatically by the new built-inEmailLogger. Each log entry is enriched viawoocommerce_email_log_contextwith the withdrawal request id, scope and the SHA-256 receipt hash plus its UTC timestamp, so the log entry can be cross-checked against the email actually delivered to the customer. The filter is silently ignored on older WooCommerce versions. - Article 11a label safety net: a new helper (
apg_withdrawal_label_is_ambiguous()) flags withdrawal labels that fail the “unambiguous wording” requirement of Article 11a of Directive 2011/83/EU. Used in two places: (a) the configurable confirmation button label (Settings → Button text) now surfaces an admin warning if the merchant saves an ambiguous wording (e.g. “Contáctanos”, “Gestionar pedido”, “Volver”); the choice is not blocked, only flagged; (b) the[apg_withdrawal_link]shortcode and the matchingapg-withdrawal/linkGutenberg block emit a_doing_it_wrong()notice (visible withWP_DEBUG) when an ambiguous customlabelattribute is used. Lists of “passes” and “blacklist” terms are filterable viaapg_withdrawal_label_unambiguous_termsandapg_withdrawal_label_ambiguous_terms. - Annex I.B link redesign on the public form: replaced the single long inline link with a short descriptive sentence (“If you prefer, you can use the official model (Annex I.B).”) plus a “Print” button styled with the native WooCommerce button classes. The button appends
?print=1to the Annex I.B URL so the browser print dialog opens automatically on page load (the existing on-page Print button still works for users who reach the URL directly). - Annex I.B addressee block polish: the merchant state and country are now rendered with their human-readable names (via
WC()->countries->get_countries()andget_states()) instead of the rawXX:YYISO code stored inwoocommerce_default_country, each on its own paragraph. Every paragraph in the addressee block ends with a period, as expected in formal correspondence. - WPML / Polylang integration for merchant-configurable strings: the confirmation button text, the digital-content waiver custom label and the four per-type exclusion notices are now registered with WPML’s String Translation (Polylang ships a compatibility layer for the same
wpml_register_single_stringaction) oninit. When neither plugin is active the registration is a no-op and the original value is rendered unchanged. - Rate limiting + honeypot on the public form: a new
apg_withdrawal_is_rate_limited()helper throttles repeated submissions by IP + email pair (default policy: 5 attempts per 10 minutes, both filterable viaapg_withdrawal_rate_limit_maxandapg_withdrawal_rate_limit_window). A hidden honeypot field is rendered in both steps of the form and silently swallows automated submissions before any persistence happens. Client IP detection respects common reverse-proxy headers and is filterable viaapg_withdrawal_client_ip. - Verified Article 11a continuous visibility throughout the 14-day window: the My Account Orders “Withdraw from the contract here” action is shown for every order whose withdrawal deadline is still open, regardless of the WooCommerce status, with the deadline source automatically falling back from
completed_datetocreated_datefor orders that have not yet been marked complete. No code change required.
0.5.0
- Compliance with Directive (EU) 2023/2673 (amends Directive 2011/83/EU on
Follow this listing's changes (Atom feed)