Implementing Lesson 46: Enforcing a Minimum Bid Increment in Flipnzee Auctions

In the previous lesson, we discussed why every professional auction system should require a minimum increase over the current highest bid. In this implementation lesson, we’ll modify the Flipnzee Auctions plugin so that users cannot place insignificant bids and always know the minimum amount required.

By the end of this implementation, the plugin will:

  • Reject bids that are too low.
  • Display the minimum allowed bid.
  • Guide users with browser-side validation.
  • Improve the overall auction experience.

Step 1: Define the Minimum Increment

Open:

includes/class-bid-manager.php

Locate the section where the current highest bid is retrieved.

Immediately afterwards, add:

/*
 * Minimum bid increment.
 */
$minimum_increment = 10;

$minimum_allowed_bid =
    (float) $current_bid +
    $minimum_increment;

This calculates the lowest amount that can be accepted.

For example:

Current Bid:      $444
Minimum Increment $10
Minimum Bid:      $454

Step 2: Validate Incoming Bids

Find the existing validation:

if ( $bid_amount <= (float) $current_bid ) {
    return false;
}

Replace it with:

/*
 * Validate minimum bid.
 */
if ( $bid_amount < $minimum_allowed_bid ) {
    return false;
}

Now every new bid must be at least Current Bid + $10.

Examples:

Current BidSubmitted BidResult
$444$445❌ Rejected
$444$450❌ Rejected
$444$454✅ Accepted
$444$500✅ Accepted

Step 3: Display the Minimum Bid

Open:

includes/class-shortcodes.php

Locate the auction details table.

Immediately below the Current Bid row, insert:

<tr>
    <th>Minimum Bid</th>
    <td>
        <?php
        $minimum_bid =
            (float) $auction['current_bid'] + 10;

        echo esc_html(
            '$' . number_format_i18n(
                $minimum_bid,
                0
            )
        );
        ?>
    </td>
</tr>

The auction information now becomes:

Start Price      $111
Current Bid      $444
Minimum Bid      $454
Buy Now          $333

Visitors immediately know the next valid bid amount.


Step 4: Restrict the Bid Input

Still in:

includes/class-shortcodes.php

Locate the bid input field.

Replace it with:

<?php
$minimum_bid =
    (float) $auction['current_bid'] + 10;
?>

<input
    type="number"
    step="10"
    min="<?php echo esc_attr( $minimum_bid ); ?>"
    value="<?php echo esc_attr( $minimum_bid ); ?>"
    name="bid_amount"
    placeholder="Your Bid"
    required
>

This provides three improvements:

  • min prevents smaller values from being submitted.
  • value pre-fills the next valid bid.
  • step increases or decreases by $10 using the spinner controls.

Testing the Feature

After refreshing the auction page, the auction details should resemble:

Current Bid      $999
Minimum Bid      $1009

Your Bid
[1009]

[ Place Bid ]

Testing results:

BidExpected
1000❌ Rejected
1005❌ Rejected
1009✅ Accepted
1019✅ Accepted

Browser Validation

Modern browsers also assist users before the form is submitted.

Attempting to enter a value below the minimum now displays a validation message similar to:

Value must be greater than or equal to 1009.

This improves usability by informing users immediately rather than after submission.


Files Modified

During this implementation, only two files required changes:

includes/class-bid-manager.php
includes/class-shortcodes.php

Keeping the modifications localized makes the feature easier to maintain and extend.


Result

After completing this implementation, Flipnzee Auctions now provides a more professional bidding experience by:

  • Enforcing a minimum bid increment on the server.
  • Displaying the minimum allowed bid to visitors.
  • Preventing invalid bids through browser validation.
  • Reducing unnecessary or insignificant bid increases.

These enhancements make the auction process clearer, fairer, and more intuitive for bidders.

Download Source Code

Download the starting version of the plugin before the lesson:

⬇ Download Plugin (After Lesson 45) (1 download )

Download the completed version after this lesson:

⬇ Download Plugin (After Lesson 46) (0 downloads )

What’s Next?

In the next lesson, we’ll continue improving the auction experience by adding more intelligent bidding features, making Flipnzee Auctions feel even closer to a production-ready auction platform.

Leave a Reply