Nera – Instant Win Rules WP Registry grade A. No security issues foundWP RegistryNo security issues foundOpen the reportA
Additional Instant Win Prize Rules (Schedule and Ticket Sold Percentage Logic)
★ 0stars
67release downloads
v1.0.38latest · 3mo ago
Install
Upload it under Plugins → Add New Plugin → Upload Plugin, then activate.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/nera-marketing/nera-instant-win-threshold/releases/download/v1.0.38/nera-instant-win-threshold-1.0.38.zipUpdates itself. It ships its own updater (Plugin Update Checker), so new versions appear under Dashboard → Updates.
Instant win rule types, public prize visibility, and optional instant-win UI overrides for Lottery for WooCommerce.
Description
This plugin extends Lottery for WooCommerce (Giveaway for WooCommerce) with:
- Instant win rule types: instant, scheduled, and ticket-sold percentage thresholds
- Public prize visibility controls
- Optional instant-win section UI overrides for compatible themes
Requires the Lottery for WooCommerce plugin to be installed and active.
Installation
- Install and activate Lottery for WooCommerce.
- Upload and activate Nera – Instant Win Rules.
- Configure instant win rules and visibility on competition products as supported by your theme and Lottery for WooCommerce.
Changelog
1.0.37
- Fix - Resolve product id in the Add Rule modal after LFW AJAX so Held-back Rule type options stay correct on User Chooses products.
- Fix - Re-render the rules table after a successful bulk Save so canonical ticket numbers appear immediately.
1.0.36
- Feature - Held-back Prize is enabled by default (opt out with
NERA_IWT_ENABLE_HELD_PRIZE_TYPE= 0 in wp-config). - Feature - Held-back Prize is limited to Ticket Generation Type “User Chooses the Ticket”; Automatic products keep Ticket % / Schedule instead.
- Fix - Server-side guards block Held-back on Automatic products and prevent switching a product to Automatic while Held-back rules exist.
- Fix - Stamp missing
lty_lottery_idon instant-win logs so storefront / order-received winner lookups match. - UI - Success toast after held-prize activate/deactivate/edit so admins know the change auto-saved.
1.0.34
- Fix - Dead-order cleanup rewritten for full LFW parity (closes the "customer pays a revived order, gets zero tickets" gap): on cancelled/refunded/failed the fallback now removes tickets of ANY status (LFW parity — a full refund forfeits entries), resets instant-win logs per LFW's cancel path (
remove_won_prizeon won logs + release), decrements_lty_ticket_countfor deleted promoted tickets only, flushes per-user LFW transients, and ALWAYS clears LFW's three order metas (lty_ticket_ids_in_order,lty_lottery_ticket_created_once,lty_lottery_ticket_updated_once) plus order-item ticket metas — restoring LFW's revive contract so failed→re-paid or untrash→paid orders get fresh tickets. - Fix - Trash/delete cleanup stays pending-only (admins trash paid orders during manual cleanup) but now clears the revive metas when the order holds zero lottery tickets afterwards, so a fully-unpaid order revives cleanly on untrash + pay.
- Dev - Dropped redundant
wp_trash_post/before_delete_postregistrations — WooCommerce fireswoocommerce_trash_order/woocommerce_before_delete_orderin both HPOS and legacy storage. - Docs -
docs/ORDER-TICKET-CLEANUP.md: v1.0.34 parity-cleanup section.
1.0.33
- Fix - Stock recalc on order death: on order cancelled/refunded/failed/trash/delete (priority 30, after LFW's ticket removal and the v1.0.32 orphan cleanup), re-apply LFW's stock formula (
max_tickets − placed_ticket_count) for every lottery product in the order. Closes the leak where a product save baked an unpaid order's pending-ticket reservation into_stockand the later cancel deleted the tickets without any recalc (WooCommerce restock is a no-op for never-reduced stock) — stock ran permanently low and produced a false "out of stock" while tickets remained (incident 2026-07-02 #2, order 154701, −1000 stock). - Docs -
docs/ORDER-TICKET-CLEANUP.md: second incident write-up and the new recalc behaviour.
1.0.32
- Fix - Orphaned pending-ticket cleanup fallback: on order cancelled/refunded/failed and on trash/delete (which LFW never handles), leftover
lty_ticket_pendingposts are removed by querying theirlty_order_idmeta directly, so cleanup works even when LFW'slty_ticket_ids_in_orderorder meta is missing. Also resets instant-win logs locked by the dead order, prunes both_lty_hold_tickets/lty_hold_ticketsmetas, and flushes LFW counter transients. Prevents orphaned pending tickets from counting as "placed" and driving stock negative on product save (WooCommerce "out of stock" while tickets remain). - CLI - New
scripts/fix-orphaned-lottery-tickets.phprepair for existing orphans: audits pending tickets on trashed/cancelled/refunded/failed/missing orders (dry-run by default;apply, optionalclear-holds), then recalculates product stock via LFW's own math. - Docs -
docs/ORDER-TICKET-CLEANUP.md: incident background and production runbook.
1.0.31
- Removed — per-product Ticket Number Max field. Shuffle/random ticket pool ceiling now always defaults to the product's Lottery Maximum Tickets (NERA_IWT_MAX_TICKET_NUMBER remains the fallback only when Maximum Tickets is unlimited).
1.0.30
- Fix — Export/import: after each import batch, stamp
lty_lottery_idand lottery start/end dates on imported instant-winner logs via LFW'smaybe_update_instant_winner_log()so imported prizes appear in the admin list and public winning-ticket lookup can match them. - Fix — Export/import: flush LFW's instant-winner-rules count transient after import so the Instant Win Prizes tab paginates correctly (no stale cached count hiding rules beyond page 1).
1.0.29
- Admin — Export/import: batch-bounded CSV re-read when applying Nera Rule Type / Ticket % after each import batch (uses
position+get_position_count()— O(N) total instead of re-reading the full file every batch). - Admin — Export/import: safe cross-product copy — on upload, blank foreign rule IDs and rewrite Product ID so rows from another competition create fresh rules under the target product instead of corrupting the source.
- Admin — Export/import: enforce numeric ticket-pool range on import rows (same bounds as Add Rule / Save; all-digit ticket numbers only).
- Admin — Export/import: block group-mode CSV rows (rows with Group Prize Title) from importing into a Default-mode product — fails the row with a clear error instead of silently flattening and losing prize-group association. Override:
nera_iwt_allow_import_mode_mismatchfilter. - Admin — Export/import: document that Schedule datetimes are not exported (Schedule Prize disabled by default); Rule Type + Ticket % round-trip only.
- REST — Group display mode:
GET /wp-json/nera/v1/instant-wins/{product_id}returns a group-shaped payload when the product's Instant Win Prize Display Mode is "Display Prizes by Group" — one entry per LFW prize group withtickets[], merged visibility (instant > ticket-% > schedule), and shared schedule field derivation. - REST — Default display mode payload unchanged except new top-level
display_modekey (default|group). - REST — Refactor schedule field derivation into shared helper used by both default and group branches.
- Removed — Internal dev test scripts (
tests/test-buy-all-rounds-e2e.php,tests/test-projection-drain.php); not shipped in release zip.
1.0.28
- Fix — Part A: thread a projected in-flight ticket count through threshold evaluation during checkout so that a purchase which crosses a ticket-sold-% threshold releases the prize number into the same order's assignable pool (no longer requires a subsequent purchase or cron run).
- Fix — Part B:
lty_get_random_ticket_numbers()now uses the same exact-drain strategy as shuffle for pools ≤ NERA_IWT_SHUFFLE_MATERIALIZE_MAX (default 50000), eliminating random under-fill near pool exhaustion onrandom-type products. - Hard guarantee: automatic shuffle/random products at full sellout assign every prize ticket number (instant + ticket-%) to a buyer, whether bought in one order or split across many.
- Admin — Won prizes: order link below status dot in the Instant Win rules table.
1.0.27
- Fix — Ticket generator excludes locked instant-win prize numbers on every path (shuffle/random pools); REST API
woocommerce_after_order_object_savehold sync before LFW assigns tickets. - Fix — MU-plugin shim self-heals when the override path changes (site clone / environment move).
- Admin — Instant Win rules table: row status dots and legend (locked / available / won).
- Removed — One-off
scripts/fix-ticket-19984.phpremediation and mu-plugin loader (no longer shipped).
1.0.26
- Fix — Checkout: bypass LFW hold-ticket NOT REGEXP guard for large orders (avoids MySQL regex timeout and infinite retry on big ticket quantities; threshold configurable via
NERA_IWT_HOLD_REGEXP_BYPASS_MIN). - Performance — Shuffle/random ticket pools: use rejection sampling for large pools instead of materialising full
range(1, max); faster lookups when drawing random numbers. - Storefront — Checkout loading overlay (branded dots + status message) while place-order AJAX runs for large lottery orders.
1.0.25
- Fix — Ticket pool max: when Ticket Number Max is unset, default the shuffle/random pool ceiling to the product's LFW maximum tickets; configured cap never falls below that value (avoids pool exhaustion before all buyer slots are filled).
1.0.24
- Admin — Instant Win rules CSV export/import: include Rule Type and Ticket % columns (LFW export hooks + post-import pass to persist Nera meta via
nera_iwt_persist_rule_visibility_meta()).
1.0.23
- Maintenance release: version bump and GitHub release asset sync for Plugin Update Checker.
1.0.22
- Admin — Instant Win rules table: search/filter rows by ticket number, prize message, or prize group (persists across pagination).
- Release — version bump and GitHub release asset sync for Plugin Update Checker.
1.0.21
- Scripts — Ship
scripts/fix-ticket-19984.php(one-off WP-CLI / admin-post remediation for a held prize number assigned before the v1.0.20 Store API checkout fix) andscripts/nera-iwt-fix-ticket-19984-loader.php(mu-plugin loader that skips quietly when the remediation script is not deployed).
1.0.20
- Fix — Sync prize hold tickets on block checkout / Store API (
woocommerce_store_api_checkout_order_processed) as well as classic checkout, so held instant-win ticket numbers are not assigned when orders use Cart/Checkout blocks or Store API gateways (e.g. woo-wallet).
1.0.19
- Public — Drop duplicate section wrapper; theme
nera_competitions_render_instant_win_prizes_section()owns layout; plugin supplies inner template via template-part bridge only. - Removed
instant-win-prizes-below-hero.phpandnera_competitions_instant_win_prizes_section_htmlfilter.
1.0.18
- Admin — Per-product Ticket Number Max (Ticket Generation Settings) drives numeric ticket pool upper bound with site/LFW fallbacks; instant-win validation and helpers aligned (
ticket-generation-override,admin-instant-win-ticket-range). - Admin — Guards when Ticket Generation is Automatic: block Schedule / Ticket Sold % rule types and switching away from Automatic while those rules exist (server + client).
- Admin — Instant Win rules note shows the current allowed numeric ticket range for the product (effective start through resolved max).
- Admin — Rule visibility JS: robust parsing for localized ticket cap; Ticket Number Max field placement next to LFW ticket prefix.
1.0.15
- Tooling —
release.shsets release commit author from repository.git/config(local), then global Git config, with existing defaults only as fallback.
1.0.14
- Admin — Instant Win rules: validate Ticket Number is within the product’s numeric pool (Add Rule modal + Save on the rules table). Lower bound = effective ticket starting number (manual or automatic; supports 0 and any LFW-configured start). Upper bound = NERA_IWT_MAX_TICKET_NUMBER when > 0 in wp-config, otherwise start + maximum tickets − 1 (aligned with Lottery for WooCommerce). Client
alertand blocked AJAX on failure. - New:
inc/admin-instant-win-ticket-range.php(server validation onlty_add_instant_winner_rule/lty_save_instant_winners_rulesafter the sequential pattern guard). JS usesadmin-rule-visibility.jsand localizedneraIwtAdminbounds.
1.0.13
- Admin — Block saving instant-win rules when Ticket Number Pattern is Sequential and Rule type is Schedule or Ticket Sold % (AJAX + modal guard); supports Automatic and User Chooses ticket modes.
- Admin — After changing Ticket Number Pattern to Random/Shuffled in the product form, clear the Lottery “unsaved instant win rules” lock so WordPress Update works without a full reload (capture-phase submit + SelectWoo-friendly handlers).
- Storefront — Instant Win REST / counts list all CMS-configured prizes (schedule / ticket-% metadata preserved); optional client header sync without hiding scheduled rows.
- REST — Prize payload includes
ticket_pctfor themes.
1.0.12
- Admin — Instant Win rules: Add Rule modal fields aligned with Lottery for WooCommerce (same
<p>layout and 50% widths as Ticket / Prize rows;datetime-local+ ticket % covered where LFW omits them). - Admin — product rules table: Rule type column sizing;
select.nera-iwt-public-rule-typeuses full cell width (100% !important) so it matches Schedule at / Schedule end / Ticket sold (%) beside Lottery’s global130pxselect rule.
1.0.11
- WordPress 6.3+ updates: pre-create
upgrade-temp-backupplugin/theme dirs; optional skip of Core’s temp-backup move viaNERA_SKIP_UPGRADE_TEMP_BACKUP,WP_ENVIRONMENT_TYPE=local, ornera_skip_upgrade_temp_backup(helps Windows/Laragon when updates fail with “Could not move the old version to the upgrade-temp-backup directory”).
1.0.10
- Maintenance release: version bump and GitHub release asset (
release.sh).
1.0.9
- Restore
release.shand align releases with the Nera Competitions Standard pattern: PHPZipArchive-first zip, sync back into this repo, commit, pushmain+ tag (no orphangit initforce-push), so tooling stays on GitHub.
1.0.8
- Plugin list and Dashboard → Updates thumbnail: ship
assets/icon-128x128.pngandassets/icon-256x256.png(from the project logo) for WordPress and Plugin Update Checker.
1.0.7
- Release zip is built with forward-slash paths only (Info-ZIP
zipor PHPZipArchive) so WordPress updates no longer fail with "Could not copy file …\lib\" when the archive was created with PowerShellCompress-Archive. Includesbuild-wp-release-zip.phpandrelease.shupdates.
1.0.6
- Release tooling and PUC metadata alignment (readme.txt, plugin.json). Full notes: https://github.com/Nera-Marketing/nera-instant-win-threshold/releases
1.0.5
- Maintenance release. Full notes: https://github.com/Nera-Marketing/nera-instant-win-threshold/releases
Releases
Newest 25 of 37 recorded releases. Each count is every asset in that release; expand a row for the breakdown.