Skip to content

Restrict bulk buy max to coupon target ticket only#38

Open
dd32 wants to merge 1 commit intoproductionfrom
fix/claude/1305-bulk-buy-target-ticket-v2
Open

Restrict bulk buy max to coupon target ticket only#38
dd32 wants to merge 1 commit intoproductionfrom
fix/claude/1305-bulk-buy-target-ticket-v2

Conversation

@dd32
Copy link
Copy Markdown
Owner

@dd32 dd32 commented Mar 12, 2026

Summary

  • The tix_bypass_max_tickets_per_order coupon option was globally increasing the max tickets per order for ALL ticket types, not just the tickets the coupon targets
  • Now the increased max is only applied to tickets where the coupon is actually applied (tix_coupon_applied === true)
  • This follows up on PR Allow bypassing max ticket limit when using coupon code WordPress/wordcamp.org#990 which introduced the bulk buy feature

Changes

Three locations in camptix.php were fixed:

  1. Ticket selection form initialization (~line 5360): Removed the global $max_tickets_per_order bump when coupon is loaded
  2. Ticket selection form rendering (~line 5746): Changed to use a local $ticket_max variable instead of mutating the shared $max_tickets_per_order
  3. Order verification (~line 7664): Added per-ticket check using $item_max that only bumps the max for coupon-applied tickets

Test plan

  • Existing CampTix tests pass (63 tests, 80 assertions)
  • Create a coupon that applies to Ticket A only, with bulk buy enabled
  • Verify Ticket A shows the increased quantity dropdown (3x)
  • Verify Ticket B (not targeted by coupon) still shows the normal max quantity
  • Verify order validation enforces the correct limits per ticket type

Fixes WordPress#1305

🤖 Generated with Claude Code

The bulk buy coupon option (tix_bypass_max_tickets_per_order) was
increasing the max tickets per order globally for all ticket types,
not just the tickets the coupon applies to. This meant non-target
tickets could also be purchased in bulk quantities.

Now the increased max is only applied per-ticket when the coupon is
actually applied to that ticket, using a local variable instead of
mutating the shared max_tickets_per_order.

Fixes WordPress#1305

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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