Created
July 20, 2021 20:14
-
-
Save KZeni/a6f6beda651a6ab39146e367722be3a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Force the Name field in the Event Ticket (Plus) ticket attendee information is unique (which may be intentionally hidden [which makes this even more important since you can see/fix the issue of the name fields needing to be unique per Event Tickets for The Events Calendar, currently & oddly.]) | |
function makeEventTicketAttendeeNamesUnique() { | |
$('.tribe-tickets__iac-field--name .tribe-tickets__form-field-input').each(function (i) { | |
if (!$(this).hasClass('duplicate-prevented')) { | |
var originalValue = $(this).val(); | |
$(this).val(originalValue + ' #' + (i + 1)); | |
$(this).addClass('duplicate-prevented'); | |
} | |
}); | |
} | |
// Only bother running on event detail pages where tickets are offered | |
$('body.single-tribe_events').on('click change', 'a,button,input', function () { | |
// Instant update | |
makeEventTicketAttendeeNamesUnique(); | |
// Account for the modal overlay for ticket info to be shown before augmenting | |
setTimeout(function () { | |
makeEventTicketAttendeeNamesUnique(); | |
}, 1000); | |
setTimeout(function () { | |
makeEventTicketAttendeeNamesUnique(); | |
}, 5000); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment