Three rules shape the plugin. Each one exists because a checkout tick box that ignores it looks compliant and proves nothing.
- A consent that is not recorded is not a consent. The point of the box is being able to show, months later, that this customer ticked it. So the acceptance is written onto the order.
- The words they agreed to are stored with the agreement. If you rewrite your terms next month, a past order must still say what was actually agreed. So the wording as it was shown is copied onto the order — not a pointer to a setting that has since changed.
- Required means required. A browser's
requiredattribute is a courtesy; anybody can post past it. A required box that was not ticked is refused on the server, before the order exists.
The plugin reaches both of WooCommerce's checkouts from the same five boxes, but by two different routes.
The classic checkout
This is the checkout drawn by the [woocommerce_checkout] shortcode.
Where the boxes print
The boxes print on woocommerce_review_order_before_submit, the WooCommerce hook directly above the Place order button. Each is a real <input type="checkbox"> inside its own <label>, so tapping the words ticks the box. A required box carries the required attribute and an asterisk.
The plugin's small stylesheet is registered on every page but only loaded when a box was actually drawn. A store with no boxes ships nothing.
The refusal
When the customer presses Place order, WooCommerce runs woocommerce_checkout_process before it creates anything. The plugin checks every active, required box there. For each one that was not ticked it adds an error notice with that box's refusal message, and WooCommerce stops.
The checkout is redrawn with the error. Boxes the customer did tick are read back from the request and stay ticked, so a checkout refused for some other reason — a missing postcode — does not make them tick three boxes again. The same holds when the classic checkout refreshes itself after an address, shipping or payment change: WooCommerce redraws the area around the pay button from the server, and the plugin reads the ticks back from that refresh request too.
The record
When WooCommerce creates the order it fires woocommerce_checkout_create_order. The plugin writes the record onto the order object there, and WooCommerce saves it with the order.
The Checkout block
The Checkout block, which WooCommerce gives a new shop by default, renders in the browser and fires none of the classic hooks above. Rather than build a second checkout of its own, the plugin hands each box to WooCommerce through WooCommerce's additional checkout fields API.
- On
init, every active box is registered as a checkbox field in theorderlocation, with the idgatemi-checkout-consent/{box id}. A required box is registered as required, with its refusal message. - WooCommerce draws the fields in the block's Order information step, above the pay button.
- When the customer pays, WooCommerce itself refuses a required box that was not ticked, using the refusal message, before the order is placed.
- WooCommerce stores each tick on the order as
_wc_other/{field id}. - When WooCommerce fires
woocommerce_store_api_checkout_order_processed— after the fields are on the order, before payment is taken — the plugin reads those ticks back, writes its own record with the wording and the time, and saves the order.
So both checkouts end with exactly the same record.
Two consequences of using WooCommerce's API:
- The wording is plain text on the block. The API cannot show a link inside a field label, so the plugin passes the wording with its markup removed. A box whose wording is only markup has no words left and is not shown on the block.
- A consent is never pre-ticked on the next order. Fields in the
orderlocation are never copied onto the customer's account (only address and contact fields are), so every order asks again.
The two routes never meet: a block checkout fires none of the classic hooks, and the classic checkout draws none of the block's fields.
What is recorded
For each box the customer ticked, the order gets one entry in the _gmcc_consents order meta:
| Field | What it holds |
|---|---|
id |
The box's id |
label |
The wording shown, as plain text (link markup removed) |
at |
The time, YYYY-MM-DD HH:MM:SS, in UTC |
Worked example. On 3 March a customer ticks I agree to the terms and conditions. On 10 April you change the wording to I accept the updated terms (April 2026). The March order still says I agree to the terms and conditions — agreed 2026-03-03 14:22:05 UTC. That is the reason the words are stored rather than looked up.
A few details:
- Only ticked boxes are recorded. An optional box left unticked writes nothing. An order where nothing was ticked carries no consent meta at all.
- Only boxes shown at that checkout count. A box switched off with Show this one is neither shown nor recorded.
- The meta goes through the order's own API, so it works the same on High-Performance Order Storage and on the older posts storage.
The Consent panel
On the order edit screen — the HPOS WooCommerce → Orders screen and the classic post editor alike — the plugin adds a Consent panel in the sidebar. It lists each recorded box in bold, with agreed … UTC beneath it.
The panel is added only when the order has a record. An empty panel on every order is one a merchant learns to ignore, and it would be ignored on the one order where it matters.
What uninstalling removes
Deleting the plugin removes the gmcc_boxes option — the boxes you configured. It never removes the _gmcc_consents record on any order, nor the _wc_other/… ticks WooCommerce stored. What a customer agreed to stays on the order. Note that the Consent panel is drawn by the plugin, so once it is removed the record is still in the order's data but no longer shown on the order screen.
