Lesson 106 Implementation: Enforcing Reserve Price Rules in Flipnzee Auctions
One of the most important concepts in professional auction platforms is the reserve price. While Flipnzee Auctions already supported defining a reserve price, the auction engine still declared a winner even when the highest bid failed to reach that minimum value. This could result in incorrect transactions, transfer records, and buyer notifications.
In this lesson, we corrected the auction workflow so that a winner is only declared when the reserve price has actually been met.
Why This Lesson Was Needed
Consider the following auction:
- Start Price: $100
- Reserve Price: $200
- Highest Bid: $10
Previously, the plugin incorrectly:
- Declared the bidder as the winner.
- Created a transaction record.
- Created a transfer record.
- Began the ownership transfer workflow.
This behavior defeats the purpose of a reserve price. The seller should never be forced to sell below their minimum acceptable amount.
Objectives
By the end of this lesson, the plugin should:
- Respect reserve prices when determining a winner.
- Prevent winner declaration if the reserve price is not met.
- Stop transaction creation.
- Stop transfer creation.
- Record the event in the activity log.
- Return control safely without breaking the auction workflow.
Creating a Reserve Price Validation Method
Rather than scattering reserve price checks throughout the codebase, we introduced a dedicated helper method inside the bid manager.
Example:
public static function reserve_price_met(
$auction_id,
$winner
)
This method centralizes all reserve-price logic into one reusable location.
Loading Auction Information
The helper retrieves the auction record from the database.
This allows us to compare:
- Reserve Price
- Highest Bid
without duplicating database queries elsewhere.
Comparing Highest Bid Against Reserve Price
The core comparison is straightforward.
If:
Highest Bid < Reserve Price
then:
- No winner should exist.
- The auction closes without a successful sale.
Otherwise:
Highest Bid >= Reserve Price
the auction proceeds normally.
Logging Failed Reserve Checks
When a reserve price is not met, the plugin now records an activity log entry.
Example:
reserve_not_met
Highest bid $10 did not meet reserve price $200.
This provides administrators with a complete audit trail explaining why an auction ended without a winner.
Updating Winner Determination
Previously, the plugin always returned the highest bidder.
Now the workflow becomes:
Find highest bid
↓
Check reserve price
↓
Reserve met?
├── Yes
│ Return winner
│
└── No
Return false
This small change completely alters the auction outcome.
Preventing Downstream Processing
Returning false immediately prevents the rest of the auction pipeline from executing.
As a result:
- Winner notifications are not generated.
- Seller notifications are skipped.
- Admin notifications are skipped.
- Transactions are not created.
- Transfer records are not created.
The auction simply ends without a successful sale.
Testing Scenario
We created the following auction:
| Setting | Value |
|---|---|
| Start Price | $100 |
| Reserve Price | $200 |
| Buy Now | $500 |
| Highest Bid | $10 |
Expected behavior:
- No winner declared
- No transaction
- No transfer
- Auction closes normally
Test Results
After implementing the reserve price validation:
✔ Highest bidder was not declared as the winner.
✔ No transaction record was generated.
✔ No transfer record was generated.
✔ Auction closed successfully.
The backend auction logic now correctly respects reserve prices.
Remaining UI Improvement
One cosmetic issue remains.
The auction page currently displays:
Auction Closed
Winning Bid: $0.00
Although technically harmless, this can confuse users because no winning bid actually exists.
A future lesson will improve the interface by displaying messages such as:
Reserve Price Not Met
Highest Bid: $10
No winner was declared because the reserve price was not reached.
Why This Improvement Matters
Professional auction platforms such as eBay and domain marketplaces rely heavily on reserve prices to protect sellers.
By enforcing reserve prices correctly, Flipnzee Auctions now:
- Protects seller interests.
- Prevents accidental sales below minimum value.
- Stops unnecessary transaction creation.
- Prevents incorrect ownership transfers.
- Produces a more reliable auction workflow.
What We Accomplished
In this lesson we:
- Added centralized reserve price validation.
- Checked reserve prices before declaring a winner.
- Prevented winner creation when the reserve price was not met.
- Logged reserve failures for administrators.
- Prevented transaction generation.
- Prevented transfer generation.
- Verified the workflow using live auction testing.
Flipnzee Auctions now follows a much more robust auction lifecycle by ensuring that reserve prices are enforced before any sale is finalized. This improvement lays the groundwork for future enhancements such as reserve price status badges, improved auction summaries, and more informative buyer and seller notifications.
Download Source Code
Download the starting version of the plugin before the lesson:
Download the completed version after this lesson:
