Share Limit Between Two Different Choices on the Same Field

Code

Filename: gplc-share-limit-between-two-different-choices.php

<?php
/**
 * Gravity Perks // Limit Choices // Share Limit Between Two Different Choices on the Same Field
 * https://gravitywiz.com/documentation/gravity-forms-limit-choices/
 */
// Update the "123" to your form ID and "4" to your field ID.
add_filter( 'gplc_choice_counts_123_4', function( $counts, $form, $field ) {
	// Update "First Choice" and "Second Choice" to the values of the two different choices.
	$counts['First Choice'] += $counts['Second Choice'];
	$counts['Second Choice'] = $counts['First Choice'];
	return $counts;
}, 10, 3 );

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.