Skip to content

Apply excluded user roles to WooCommerce events (1.2.3) - #30

Merged
kskonovalov merged 9 commits into
mainfrom
fix/woo-excluded-roles
Nov 3, 2026
Merged

kskonovalov merged 9 commits into
mainfrom
fix/woo-excluded-roles

Conversation

@kskonovalov

Copy link
Copy Markdown
Collaborator

Why

The excluded-roles setting removed the tracking script for a selected role, but server-side WooCommerce events ignored it. An excluded administrator's AddToCart, InitiateCheckout and Purchase were still captured from their own signed-in requests.

What changes

  • post_event() skips an event from an excluded user's own request: no event, no blocked report, nothing held, and the skip is written to the debug log.
  • The gate judges the current request only. A replay of events held earlier and a request that is not the buyer's (staff completing a customer's order, a gateway webhook) are unaffected.
  • A skipped Purchase is not recorded as delivered.
  • The setting is renamed Exclude Tracking for User Roles, and the settings page and FAQ state both limits below.
  • Version 1.2.3.

Accepted limits

  • If a later request that is not the excluded user's moves their order to a purchasing status, the Purchase is sent. This was a deliberate decision and is pinned by a test.
  • A tracking script added to the site by hand is outside the plugin's control, so the setting cannot remove it.

Upgrade note

Sites that exclude roles may see lower event counts, because those users' WooCommerce events stop.

Verification

Full run on 4ecfab8 (later commits touch only the report and OpenSpec files):

  • PHP 512/512 (38 files, on PHP 8.5.4; not rerun on PHP 7.4)
  • Component tests 80/80
  • Admin E2E 7/7
  • Live storefront matrix 140/140, including the new excluded-role spec

The scenario matrix has a new section, ROLE-01 to ROLE-10. OpenSpec change fix-woo-excluded-roles is archived in this branch.

🤖 Generated with Claude Code

kskonovalov and others added 8 commits November 1, 2026 17:07
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The excluded-roles setting removed the tracking script but left server-side
AddToCart, InitiateCheckout and Purchase events running, so an excluded
administrator's cart and checkout were still captured.

post_event() now skips them with no blocked report and nothing held. It judges
only the user's own request: a replay of events held earlier and a request that
is not the buyer's (staff completing an order, a gateway webhook) are unaffected.
A skipped Purchase is not recorded as delivered, so such a request can send it
later. That limit is accepted and stated on the settings page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…trix

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

✅ WordPress Plugin Check Report

✅ Status: Passed

📊 Report

All checks passed! No errors or warnings found.


🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kskonovalov
kskonovalov merged commit ac37363 into main Nov 3, 2026
5 checks passed
@kskonovalov
kskonovalov deleted the fix/woo-excluded-roles branch November 3, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant