Docs Raffle for WooCommerce

Master Drawing

Master Drawing#

Combine multiple raffles into a single drawing. Each child raffle keeps its own ticket numbering, sales channel, and volunteer attribution, but the actual draw picks winners from the shared ticket pool across all linked raffles.

Useful when you want every raffle in a fundraising event — or every volunteer’s individual raffle — to feed into one final drawing while keeping the day-to-day administration separate per raffle.

Enabling#

  1. Go to WooCommerce → Settings → Raffle → Pro Modules and enable Master Drawing.
  2. The full management screen lives at WooCommerce → Raffle Tickets → Master draws.

Only users with the manage_woocommerce capability can manage master draws.

Creating a master draw#

Click New master draw and fill in:

FieldNotes
NameInternal label. Shown on the list and in winner records.
Draw date and timeOptional. When set, the master draw runs automatically at this moment via WP-Cron. Leave blank to draw manually. Stored in the WordPress timezone.
Number of winnersHow many winners to pick across the combined pool.
Linked rafflesMulti-select of raffle products. Hold Ctrl/Cmd to select several. Their ticket pools will be combined when the draw runs.

Save. The master draw shows up in the list with status Scheduled.

Running the draw#

There are two ways the draw can fire:

  • Automatic (recommended) — an hourly cron job checks for master draws whose draw_at has passed and runs them automatically.
  • Manual — click Draw now on any uncompleted master draw with at least one linked raffle and at least as many tickets as winners.

Either way, the runner is transactional. The master row is locked with FOR UPDATE so two cron runs (or a cron run firing while an admin clicks “Draw now”) can never both draw at the same time.

How the draw works#

  1. The runner queries eligible tickets across every linked child raffle.
  2. Tickets are combined into a single pool.
  3. random_int() picks N distinct indices using PHP’s cryptographically secure random source.
  4. A RFWC_Winner record is created for each selected ticket, filed under the ticket’s own child raffle ID so existing winner queries, prize fulfilment, and winner emails work without changes.
  5. Each winning ticket’s status is set to winner.
  6. Each touched child raffle is marked as completed with the draw date set to “now”.
  7. The standard rfwc_winner_selected and rfwc_raffle_completed actions fire per child raffle, so winner emails go out as usual.
  8. The master draw is marked as completed.

Per-child auto-draw is suppressed#

While a master draw is scheduled, the free plugin’s per-raffle automatic draw is suppressed for every child raffle. This is enforced via the rfwc_should_auto_draw filter and prevents a child raffle from drawing its own winners ahead of the master.

If you delete the master draw before it runs, the suppression lifts. The free plugin’s hourly cron picks up any expired child raffles and draws them individually, as if the master had never existed.

Editing and deleting#

  • Editing a master draw clears the existing child links and rewrites them with whatever’s selected. The master ID and status are preserved.
  • Deleting a master draw removes the master and its links. Existing winner records are kept — they’re already filed under the children, so they survive a master deletion.

Status values#

StatusMeaning
ScheduledEither waiting for draw_at or waiting for a manual run.
Ready to drawReserved for future enhancements. Not used yet.
CompletedWinners have been picked and notifications sent.
FailedReserved for future enhancements. Not used yet.

Notes and limitations#

  • The combined pool only includes tickets with active status. Tickets already marked as winner or cancelled are excluded.
  • The number of winners can’t exceed the combined pool size. If it does, the draw fails with a clear error instead of partial-drawing.
  • The master draw doesn’t yet support unique winners (one person can win twice across child raffles). If you need that constraint, run the draws individually with the free plugin’s “Unique winners” setting until v1.1.x adds master-level support.
  • Winner notification emails fire per child raffle, using whatever notification settings each child has configured.

Data storage#

Two custom tables:

  • wp_rfwc_pro_master_draws — one row per master draw (id, name, status, draw_at, num_winners, selection_method).
  • wp_rfwc_pro_master_draw_children — one row per master-to-raffle link, with a unique constraint on (master_id, raffle_id) so a child can only be added once per master.

A winner record created by a master draw gets a _rfwc_pro_master_draw_id meta value pointing back at the master, so you can trace winners to their source draw later.

Developer notes#

HookTypeUse
rfwc_pro_master_draw_completedActionFires after a master draw selects winners. Args: $master_id, $winners.
rfwc_should_auto_draw (free)FilterThe module returns false for any raffle in an active master. Other plugins can use this filter too for their own suppression.
rfwc_eligible_tickets (free)FilterAvailable to extensions that need to inspect or override the combined pool. The module uses RFWC_Winner_Selector::get_eligible_tickets() per child internally.