gw-round-total.js

Code

Filename: gw-round-total.js

/**
 * Experimental Snippet 🧪
 */
// Round the total field
gform.addFilter( 'gform_product_total', function(total, formId){
	var interval = 1; // Change this to the nearest percision (e.g. 10 rounds to the nearest 10,20,30... etc.)
	var base = Math.round( total / interval );
	return base * interval;
} );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.