Legal checkboxes
The Legal checkboxes module in Polski for WooCommerce puts consent checkboxes above the WooCommerce order button: terms and conditions, privacy policy and the right of withdrawal are on by default, six more boxes can be switched on. Each box has its own label and error message. You may switch the privacy policy box off, because order data rests on GDPR art. 6(1)(b).
Configuration
Section titled "Configuration"Go to Polski > Settings > Checkout & Orders and configure the "Legal checkboxes" module. For each built-in box you can switch it on or off and edit its label, error message and description. The values are stored in the polski_checkout option (terms_checkbox_label, terms_checkbox_error and so on).
Built-in checkboxes
Section titled "Built-in checkboxes"| Checkbox (ID) | Type | On by default | Where it shows |
|---|---|---|---|
Terms and conditions (terms) |
Required | Yes | Checkout, pay-for-order page |
Privacy policy (privacy) |
Required | Yes | Checkout, registration form, pay-for-order page |
Right of withdrawal (withdrawal) |
Required | Yes | Checkout |
Digital content waiver (digital_waiver) |
Required | No | Checkout, when the cart holds a downloadable product |
Service waiver (service_waiver) |
Required | No | Checkout, when the cart holds a product excluded from withdrawal as a service |
Age confirmation (age_verification) |
Required | No | Checkout, when the cart holds a product marked adults only (18+) |
Delivery notifications (parcel_delivery) |
Optional | No | Checkout |
Review reminder (review_reminder) |
Optional | No | Checkout |
Marketing (marketing) |
Optional | No | Checkout, registration form |
None of the boxes is pre-ticked. While the module is on, WooCommerce's own terms checkbox is turned off (woocommerce_checkout_show_terms), so the customer does not see two terms boxes.
Default labels
Section titled "Default labels"| Checkbox | Default label |
|---|---|
| Terms and conditions | I have read and accept the [terms and conditions]. |
| Privacy policy | I have read and accept the [privacy policy]. |
| Right of withdrawal | I confirm that I have been informed of the [right of withdrawal] within 14 days. |
| Marketing | I consent to receiving marketing communication and the newsletter from [shop name]. The shop name is your site title. Before 1.45.8 the label named no sender; a label you saved earlier is kept. |
Links in labels
Section titled "Links in labels"The terms, privacy and withdrawal labels contain a %s placeholder inside the link, which the plugin replaces with the page URL:
| Checkbox | Link target |
|---|---|
| Terms and conditions | The terms page set in the Legal pages module (polski_terms_page_id) |
| Privacy policy | The privacy page from the Legal pages module, or the WordPress privacy policy page when none is set |
| Right of withdrawal | The returns page from the Legal pages module (polski_returns_page_id) |
Without a page the link points to #. Labels allow <a>, <strong>, <em> and <br>; other HTML is removed on output.
Validation
Section titled "Validation"Server-side validation
Section titled "Server-side validation"The plugin validates the boxes on the server with the woocommerce_checkout_process hook, on the registration form (woocommerce_process_registration_errors) and on the pay-for-order page (woocommerce_before_pay_action). If a required box is not ticked, the order is not placed and the customer sees its error message. A box hidden for the current cart (for example the digital content waiver when nothing downloadable is in the cart) is not required.
In the browser
Section titled "In the browser"Required boxes are printed with the HTML required attribute and WooCommerce's validate-required class, so the browser and WooCommerce's checkout script flag them before the form is sent.
Error messages
Section titled "Error messages"Each checkbox has a configurable error message. Default messages:
| Checkbox | Error message |
|---|---|
| Terms and conditions | You have to accept the terms and conditions to place an order. |
| Privacy policy | You have to accept the privacy policy. |
| Right of withdrawal | You have to confirm that you have read the information on the right of withdrawal. |
A box with an empty error message falls back to "Please accept:" followed by its label.
Consent storage
Section titled "Consent storage"At checkout, the plugin saves every box's answer on the order as _wc_other/polski/<id> meta (1 ticked, 0 not ticked), the same key the block checkout uses.
With the Consent Logging (GDPR) module on (it is on by default), each answer is also written to the {prefix}polski_consent_log database table with the checkbox ID, context (checkout, registration or pay-for-order), the answer, user ID, IP address, user agent and UTC time. That module has no admin screen for these records.
Programmatic checkbox management
Section titled "Programmatic checkbox management"Adding a checkbox
Section titled "Adding a checkbox"Register your own box on the polski/checkboxes/registered action:
use Polski\Enum\CheckboxContext;use Polski\Enum\ConsentType;use Polski\Model\LegalCheckbox;
add_action('polski/checkboxes/registered', function ($service): void { $service->register(new LegalCheckbox( id: 'complaint_data', label: 'I consent to data processing for complaint handling purposes.', type: ConsentType::Required, contexts: [CheckboxContext::Checkout], priority: 20, errorMessage: 'You must consent to data processing.', ));});The field is posted as polski_checkbox_<id>. A box can also be limited to cart categories (categories), billing countries (countries), payment methods (paymentMethods) or product types (productTypes).
Admins can also create boxes through the REST API: POST /wp-json/polski/v1/checkboxes. Those are stored in the polski_custom_checkboxes option.
Removing or changing a checkbox
Section titled "Removing or changing a checkbox"add_action('polski/checkboxes/registered', function ($service): void { $service->unregister('marketing');});To change which boxes show in one context, filter the list:
add_filter('polski/checkboxes/for_context', function (array $checkboxes, $context, array $cartContext): array { return array_values(array_filter($checkboxes, fn ($cb) => $cb->id !== 'review_reminder'));}, 10, 3);Other hooks
Section titled "Other hooks"| Hook | Type | Arguments |
|---|---|---|
polski/checkboxes/validate/{id} |
filter | bool $shouldValidate, LegalCheckbox $checkbox, bool $checked |
polski/checkboxes/validated |
action | CheckboxContext $context |
polski/checkboxes/before_render, polski/checkboxes/after_render |
action | LegalCheckbox $checkbox, CheckboxContext $context |
polski/checkout/consents_logged |
action | array $states, WC_Order $order |
CSS styling
Section titled "CSS styling"The boxes are rendered from the checkout/legal-checkboxes template. The markup uses these classes:
.polski-legal-checkboxes { margin: 1.5em 0;}
.polski-checkbox { margin-bottom: 0.8em;}
/* One box, by ID */.polski-checkbox--marketing label { font-size: 0.9em;}Block Checkout compatibility
Section titled "Block Checkout compatibility"Checkboxes work in both the classic checkout and the block checkout. On the block checkout each box is an additional checkout field polski/<id> in the order section, with its label stripped of HTML. That gives two limits: the Terms and Privacy labels show as plain text without their links, and boxes limited by category, country or payment method rules are not shown there. Stores that rely on those boxes should use the classic checkout. The service waiver and age confirmation boxes do show on the block checkout, only when the cart holds such a product; the digital content consent comes from the Withdrawal module there and shows when the cart holds digital content.
Two more settings of the module, both off by default, apply to the block checkout only (Polski 1.50.0):
- "Accept all" box: one box above the consent boxes, labelled by Label - Accept all (default "Accept all"). It ticks or unticks every box of this module shown on the block checkout and unticks itself when the customer unticks one of them. It reacts to the customer's clicks only and never ticks anything on page load. Each consent stays its own box, validated and logged separately; "Accept all" itself is not stored on the order.
- Marketing consent next to the e-mail: the marketing box sits right under the e-mail address instead of in the order section. It stays optional and unticked, is stored in the same
_wc_other/polski/marketingmeta and logged as before, and is not filled in again from the customer's last order.
Common issues
Section titled "Common issues"Checkboxes do not display
Section titled "Checkboxes do not display"- Check that the Legal checkboxes module is enabled in Polski > Modules
- Check that the box itself is switched on in Polski > Settings > Checkout & Orders
- For a conditional box, check that the cart holds a matching product
Link in label does not work
Section titled "Link in label does not work"Check that the page is assigned in the Legal pages module and is published. Without a page the link points to #.
Order goes through despite an unchecked checkbox
Section titled "Order goes through despite an unchecked checkbox"Check that the box is required and switched on, and that no code returns false from polski/checkboxes/validate/{id} for it.
Which checkboxes are on after installation?
Section titled "Which checkboxes are on after installation?"Terms and conditions, privacy policy and the right of withdrawal, all three required. The digital content waiver, service waiver, age confirmation, delivery notifications, review reminder and marketing boxes are off until you switch them on.
Can I make the privacy policy checkbox optional or remove it?
Section titled "Can I make the privacy policy checkbox optional or remove it?"You can switch it off in the module settings. The plugin's own compliance score gives no points for it, because order data rests on GDPR art. 6(1)(b).
Where can I see what a customer ticked?
Section titled "Where can I see what a customer ticked?"On the order, in the _wc_other/polski/<id> meta. With Consent Logging on, the answers are also in the polski_consent_log table with IP address and time.