Skip to content

fix: count only placed orders in the WooCommerce retention check - #32

Merged
oxyc merged 1 commit into
mainfrom
fix/woo-retention-skip-checkout-drafts
Dec 1, 2026
Merged

oxyc merged 1 commit into
mainfrom
fix/woo-retention-skip-checkout-drafts

Conversation

@oxyc

@oxyc oxyc commented Dec 1, 2026

Copy link
Copy Markdown
Member

The retention:woo check counted every shop_order, including WooCommerce's abandoned checkout drafts and auto-drafts, which hold no customer details.

On a site whose WooCommerce was removed in 2024, two checkout drafts were left in its tables (all address fields empty). Since woocommerce_version still exists, the check asked to turn on order anonymisation for a shop that no longer exists.

Change: the order count skips wc-checkout-draft, checkout-draft, auto-draft and draft. Trashed orders still count, since they keep the customer's details until the trash is emptied.

Checked read-only on production:

  • the site above goes from 2 orders to 0;
  • a live shop on the posts table keeps all 6,408 (oldest 2021) before and after.

The collector only runs against a real WordPress, and CI's e2e site has no WooCommerce, so these live checks are the test. php -l passes.

🤖 Generated with Claude Code

Abandoned checkout drafts and auto-drafts hold no customer details. A site whose WooCommerce was removed kept two such drafts in its tables, and the check asked to turn on order anonymisation for a shop that doesn't exist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oxyc
oxyc merged commit 749885e into main Dec 1, 2026
2 checks passed
@oxyc
oxyc deleted the fix/woo-retention-skip-checkout-drafts branch December 1, 2026 23:45
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