WP Manifestindependent plugin directory
manifest / ecommerce / cancel-button-for-woocommerce

Cancel Button for WooCommerce

EU-compliant order cancellation (stop) button for WooCommerce — mandatory in the EU since 19 June 2026

by EpicWP · github.com/epicwp/cancel-button-for-woocommerce · website

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/epicwp/cancel-button-for-woocommerce/archive/refs/heads/main.zip

EU-compliant order cancellation button ("withdrawal button" / stopknop) for WooCommerce. Since 19 June 2026, EU law requires webshops to let consumers cancel an order as easily as they placed it — via a direct digital action, without logging in, available during the full 14-day withdrawal period.

Status: feature-complete for v0.1 — all core flows implemented (email button, two-step cancel page, customer confirmation email, 14-day window, Dutch translation). Pending: end-to-end testing on a staging shop before first release.

What it does

  • Cancel button in customer order emails (processing / on-hold / completed), linking to a pre-filled cancellation URL.
  • Login-free: the link authenticates with the native WooCommerce order key.
  • Two-step confirmation page: review → confirm → order is cancelled.
  • Immediate confirmation email to the customer (custom WC_Email; WooCommerce's own cancelled-order email only targets admins).
  • 14-day window: paid statuses (processing/on-hold) stay cancellable within the withdrawal period via woocommerce_valid_order_statuses_for_cancel.

Everything is built on native WooCommerce mechanisms — no custom tables, no external services. HPOS compatible.

Screenshots

All screens shown with the bundled Dutch translation and fictional example data.

Cancel button in the order confirmation email Cancel button in the order confirmation email Confirmation step of the cancellation page Confirmation step of the cancellation page
Success page after cancelling Success page after cancelling Automatic confirmation email Automatic confirmation email
Fallback when an order can no longer be cancelled online Fallback when an order can no longer be cancelled online

Architecture

Module File Responsibility
Plugin includes/class-plugin.php Orchestrator; wires modules and registers emails
Email_Button includes/class-email-button.php Button in customer emails (woocommerce_email_after_order_table)
Cancel_Page includes/class-cancel-page.php Public two-step cancellation flow (query var + template_redirect)
Order_Statuses includes/class-order-statuses.php Cancellable statuses + 14-day window logic
Emails\Customer_Cancelled_Order includes/emails/class-customer-cancelled-order.php Customer confirmation email

Templates

The cancellation pages live in templates/cancel-page/ (confirm, success, invalid, not-cancellable) and the confirmation email in templates/emails/. Themes can override any of them by copying to {theme}/cancel-button-for-woocommerce/{template}.

Hooks

  • cbfw_cancellation_window_days (filter) — length of the cancellation window in days (default 14).
  • cbfw_cancellable_statuses (filter) — extra statuses cancellable within the window (default processing, on-hold; completed is excluded by default because withdrawal after delivery is a return, not a cancellation).
  • cbfw_email_button_text (filter) — the button label in emails.
  • cbfw_template (filter) — resolved template path per view.
  • cbfw_order_cancelled_by_customer (action) — fires after a customer cancels; the confirmation email hooks in here.

Translations

Bundled: Dutch (nl_NL). Source strings are English; further languages come via WordPress.org GlotPress once the plugin is in the directory.

Development

composer install
composer run lint      # PHPCS (WordPress-Extra + PHPCompatibilityWP)
composer run lint:fix  # PHPCBF

CI runs PHPCS and a PHP 7.4 syntax check on every push/PR.

Releasing to WordPress.org

The repo is structured for the WordPress.org plugin directory:

  • readme.txt in directory format (stable tag, tested-up-to, FAQ, changelog)
  • GPLv2 license, slug/text domain cancel-button-for-woocommerce
  • .distignore + .github/workflows/deploy.yml (10up deploy action) push a clean build to SVN on every published GitHub release — once the plugin is approved and SVN_USERNAME/SVN_PASSWORD secrets are set.

License

GPL-2.0-or-later. See LICENSE.