Skip to content

Commit 1f3c0ac

Browse files
committed
gplcb-set-max-by-field-value.js: Updated snippet Set Max Limit by Field Value to work with product fields.
1 parent 2659627 commit 1f3c0ac

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

gp-limit-checkboxes/gplcb-set-max-by-field-value.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ gform.addFilter( 'gplc_group', function( group, fieldId, $elem, gplc ) {
3131
group.max = Math.max( 0, parseInt( $maxField.filter( ':checked' ).val() ) );
3232
} else {
3333
group.max = $maxField.val() ? $maxField.val() : 0;
34+
35+
// For Product field, get the value required by tokenizing the string.
36+
if ( group.max.toString().indexOf('|') > -1 ) {
37+
group.max = group.max.split(/|(.*)/s)[0];
38+
}
3439
}
3540

3641
// Only bind our event listener once.

0 commit comments

Comments
 (0)