From 9d4e7a36a7efb47f40442fe3d770c4657e50112c Mon Sep 17 00:00:00 2001 From: Brandon Li Date: Thu, 3 Sep 2026 13:13:03 -0500 Subject: [PATCH] Duplicate automations --- lib/automations.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/automations.ts b/lib/automations.ts index 8a66c27..4db61c2 100644 --- a/lib/automations.ts +++ b/lib/automations.ts @@ -298,8 +298,21 @@ export const FIRMS: Firm[] = [ // makes the two clicks self-sequence — the first tick checks // box one, so the second click resolves to box two — and // re-clicking never un-ticks a box already checked. + // + // WooCommerce only stamps validate-required on its own + // required rows; the second agreement box here is theme + // markup without that class, so the second click also + // sweeps the whole checkout form for unchecked boxes — + // minus the ones that must never be ticked (different + // shipping address expands extra fields, mailing-list + // opt-ins). No skipIfNotFound: silently skipping the + // second agreement just moves the failure to the + // modal-close gate below with a misleading timeout. { action: 'click', selector: '.validate-required input[type="checkbox"]:not(:checked)', frame: '#woocommerceModal iframe', label: 'Agree to terms' }, - { action: 'click', selector: '.validate-required input[type="checkbox"]:not(:checked)', frame: '#woocommerceModal iframe', skipIfNotFound: true, label: 'Agree to terms 2' }, + // Ticking box one can re-render the checkout (update_checkout); + // give it a beat so the second locate sees the settled DOM. + { action: 'wait', seconds: 1 }, + { action: 'click', selector: '.validate-required input[type="checkbox"]:not(:checked), form.checkout input[type="checkbox"]:not(:checked):not(#ship-to-different-address-checkbox):not([name*="subscribe"]):not([name*="newsletter"]):not([id*="newsletter"]):not([id*="mailchimp"]):not([id*="mc4wp"])', frame: '#woocommerceModal iframe', label: 'Agree to terms 2' }, { action: 'waitFor', selector: '#woocommerceModal', absent: true, hidden: true, timeoutSeconds: 30, label: 'Wait for the modal to close' },