Description
What happens when a customer types 499 into a quantity field and your print shop only produces business cards in lots of 500? Without rounding logic, you get a messy order, an awkward email thread, and a manual correction. Gravity Forms Rounding fixes that at the form level. It takes the number a visitor enters and snaps it to the increment you define, so the value that reaches your order is one you can actually fulfill.
The Gravity Forms Rounding WordPress plugin works through a single mechanism: a special CSS class added to a field. No settings screen to hunt through, no separate configuration panel. You decide the increment, write it into the field’s CSS Class Name box, and the field starts rounding.
Core Capabilities Overview
The plugin targets Number, Quantity, and Calculation fields. Each can be told to round to the nearest multiple of any value you choose. Set the increment to 500 and an entry of 499 becomes 500, while 600 moves up to 1000. Set it to 25 and 26 drops to 25 while 49 climbs to 50. The rounding follows the nearest increment, and the plugin also offers a way to push values up to the next increment when your business rule requires it.
Three things set it apart from a generic number-formatting snippet. First, increments can be decimals, so a value like 2.5 works as well as a whole number. Second, you can cap the result or set a minimum, which turns rounding into a simple way to keep orders inside a range. Third, there is a custom rounding class for cases where a plain increment is not enough, letting you write your own math for both the server and the browser.
Feature Breakdown
Rounding by Increment
This is the main feature. Add a class in the format gw-round-n to a field, replacing n with your increment. The field then rounds whatever value it receives, up or down, to the nearest multiple of n. It suits anything sold or scheduled in fixed blocks: print runs, pallet counts, packs of components, training seats, or time slots measured in set chunks.
Decimal Increments
Not everything moves in whole numbers. Fabric sold in half-meter cuts, materials priced per 0.25 unit, or a service billed in 2.5-hour blocks all need fractional steps. The rounding classes accept decimal values directly, so gw-round-2.5 rounds in steps of 2.5 with no extra work.
Caps and Minimums
Rounding can also enforce limits. A minimum guarantees that nobody orders fewer than your smallest viable batch, and a cap stops a quantity from running past what you can supply. Because the plugin handles this through the same class-based approach, you can use it to hold product totals inside a min/max window without building a separate validation routine.
Custom Rounding Class
When the built-in behavior does not match your pricing model, the gw-round-custom class lets you define your own method. You write the logic twice: once in PHP, placed in your theme, and once in JavaScript, which the plugin’s documentation suggests loading through the Code Chest plugin. Doing it in both places keeps the number a visitor sees in the browser consistent with the number your server calculates on submission. It takes more effort than a standard increment, and it is aimed at tiered or irregular rounding rules.
Works Alongside Other CSS Classes
Many forms already use the CSS Class Name setting for styling hooks or other snippets. That is not a conflict. The setting accepts multiple classes, so you add a space after the last existing one and append your rounding class. Your layout classes and your rounding class coexist in the same box.
- Rounds Number, Quantity, and Calculation field values
- Rounds up or down to the nearest increment of any value you set
- Accepts decimal increments such as 2.5
- Supports caps and minimums on rounded values
- Offers a custom class for your own PHP and JavaScript rounding logic
- Configured entirely through the field’s CSS Class Name setting
- Coexists with other CSS classes on the same field
Real-World Applications
Print and Packaging Orders
A print shop taking business card orders in lots of 500 is the classic case. A customer who enters 750 is moved to the nearest valid lot rather than submitting an order you cannot produce. Packaging suppliers selling cartons by the case, or label printers working in fixed roll counts, face the same issue and can solve it the same way.
Wholesale and Bulk Quantities
Wholesalers often sell only in multiples: boxes of 12, pallets of 48, bundles of 25. Setting the increment on the Quantity field keeps every order on a shippable multiple. Add a minimum and you also enforce a smallest order size, which saves you from turning away or renegotiating tiny requests after the fact.
Measured and Metered Services
Sign makers, fabricators, and installers who price by length or area frequently round up to a standard unit. A decimal increment handles half-foot or quarter-meter steps. A Calculation field that multiplies width by height can be rounded so the resulting figure matches how you actually quote. Because the plugin is GPL-licensed, developers can also read and extend the approach when a site needs something specific.
Min/Max Product Totals
Rounding by increments doubles as a way to keep a product total within acceptable bounds. If you only accept orders between certain quantities, pairing increments with a cap and a minimum gives you that boundary inside the form itself.
How It Works Under the Hood
The plugin reads the CSS class you add to a field and uses the number in that class as the increment. Setup takes four steps: open the form for editing, open the settings for the field you want to round, go to the Advanced tab, and add the rounding class to the CSS Class Name setting with your chosen value in place of n.
From there, rounding applies to the field’s value. For standard increments the plugin does the math for you. For the custom class, you supply the method in PHP and JavaScript so both the front end and the server agree on the result. That dual implementation matters: if only the browser rounds, a determined user could submit something different, and if only the server rounds, the visitor sees one number on screen and gets another on the confirmation.
Known Limitations
The plugin does not support Total or Product price fields. Rounding is meant for the quantity-style inputs that feed those totals, not the totals themselves. Plan your form so the rounded field drives the price calculation, and you get the effect you want without touching the price field directly.
Frequently Asked Questions
Can I round to a decimal like 2.5 instead of a whole number?
Yes. Any of the rounding classes accept decimal values, so gw-round-2.5 rounds in steps of 2.5. This is useful for measured goods, hourly blocks, or any unit that does not come in whole numbers. Enter the decimal directly in the class name.
Will the rounding class break the other CSS classes I already use on a field?
No. The CSS Class Name setting takes multiple classes separated by spaces. Add a space after your last existing class and then add the rounding class. Your styling classes keep working and the field also rounds as configured.
Can I use it on Product price or Total fields?
No, those field types are not supported. The plugin is designed for Number, Quantity, and Calculation fields. The usual approach is to round the quantity or calculated value and let that feed your price, so the total reflects the rounded amount.
What if my rounding rule is not a simple increment?
Use the gw-round-custom class and write your own method. You need to implement the math in PHP, which goes in your theme, and again in JavaScript, which the plugin recommends running through Code Chest. This gives you full control over irregular or tiered rules, at the cost of writing and maintaining that code yourself.

