Override Limit of Specific Choice

Code

Filename: gplc-override-limit-of-specific-choice.php

<?php
/**
 * Gravity Perks // Limit Choices // Override Limit of Specific Choice
 * https://gravitywiz.com/documentation/gravity-forms-limit-choices/
 */
// Update "123" to the form ID and "4" to the field ID.
add_filter( 'gplc_choice_limit_123_4', function( $limit, $choice ) {
	if ( $choice['value'] === 'First Choice' ) {
		// Update "1" to the desired limit.
		$limit = 1;
	}
	return $limit;
}, 10, 2 );

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.