snippet-library
snippet-library copied to clipboard
Initial support for rounding the total field
@claygriffiths This PR is a work in progress. I've hit a logical wall here with adding rounding support to total fields.
Rounding on the front-end is straight forward, I've added a JS hook gform_product_total which then checks for the proper classes and rounds the total correctly.
The issue now is that this is just cosmetic. We need to implement gform_product_info on the back-end to actually change the amount users will pay.
The problem here is that when applying the rounding to a total, there's no telling which product(s) prices should be affected.
My initial idea was to just split the rounded total by the quantity on the first product and then add an "adjusted rounded price" like $product_info['products']['adjusted_rounded_price'] with the difference.
That will not work though if the form has more than one product and will also cause 3rd party processing to fail.
Any thoughts here about what can be done or is this just outside of the scope of what we can support?
Per David's response, leaving this open but removing debugger in #103.