Configuration
Withdraw stores its settings in the withdraw_settings option. The settings page is available under WooCommerce → Withdrawal and requires the manage_woocommerce capability.
Settings
Section titled “Settings”- Withdrawal period (days) (
period_days), the length of the withdrawal window, clamped from 1 to 365. Defaults to 14, the statutory minimum. - Withdrawal form page (
form_page_id), the page containing the[withdraw_form]shortcode. The My Account button links here; without a selected page the button does not render. - Eligible order statuses (
eligible_statuses), checkboxes built from the registered WooCommerce order statuses. Defaults tocompletedandprocessing. Only orders in one of these statuses can be withdrawn from, and the My Account button only shows for them. - Notification email (
notify_email), where the shop notification is sent. When blank, it goes to the site admin email. - Form intro text (
intro_text), shown at the top of the lookup step. - Model withdrawal text (
model_form_text), shown on the items step. Adapt it to the statutory model withdrawal form (Annex I.B).
The settings page also shows a live count of pending, accepted, processed and rejected requests with a link to the requests screen.
Eligibility rules
Section titled “Eligibility rules”A request is only accepted when all of these hold:
- The order exists and the entered email matches the order’s billing email (case-insensitive).
- The order status is one of the eligible statuses.
- The withdrawal period is still open. The window starts at the order’s completion date or, if the order was never marked completed, at its creation date, and lasts
period_daysdays. The items step shows the exact deadline date. - No pending or accepted request already exists for the order.
Submitted quantities are capped at the ordered quantity per item, and at least one item must be selected.
The form
Section titled “The form”The [withdraw_form] shortcode renders the two-step form. It takes no attributes. Both steps are nonce-protected and the form works without JavaScript; a small script only blocks submitting the items step with nothing selected.
Requests screen
Section titled “Requests screen”WooCommerce → Withdrawal Requests lists up to 100 requests, newest first, with ID, order (linked to the order edit screen), customer email, items with quantities, date and status. Filter by status with the All / Pending / Accepted / Rejected / Processed links. Each row has a status dropdown and a Save button; the four statuses are pending, accepted, rejected and processed.
Emails
Section titled “Emails”On submit, Withdraw sends two plain-text emails through wp_mail():
- a confirmation to the customer with the order number, the withdrawn items and the reason;
- a notification to the shop (notification email or admin email) with the request ID, order number, customer email, items and reason.
Storage and uninstall
Section titled “Storage and uninstall”Withdraw stores:
withdraw_settingsandwithdraw_schema_versionoptions;- withdrawal requests in its own
{prefix}withdraw_requeststable (order ID, customer email, items, reason, status, timestamps).
The uninstall routine deletes both options and drops the requests table.