Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Created November 19, 2021 00:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pebblo/aadb2c7349b5093d807974aabf60288b to your computer and use it in GitHub Desktop.
Save Pebblo/aadb2c7349b5093d807974aabf60288b to your computer and use it in GitHub Desktop.
Example
<?php //Please do not include the opening PHP tag if you already have one
function tw_ee_ticket_selector_replace_qty_select_with_checkboxes() {
wp_add_inline_script(
'ticket_selector',
'jQuery( document ).ready(function($) {
$(".tckt-slctr-tbl-td-qty select").each(function(){
$(this).before("<input class=\'" + this.id + "\' type=\'checkbox\'>");
$(this).hide();
$(".tckt-slctr-tbl-td-qty input:checkbox").change(function(){
if(this.checked) {
var select = $("#" + $(this).attr("class"));
let value = select.find("option:eq(1)").val();
select.val(value).change();
}
});
});
$(".ee-ticket-selector-ticket-qty-th input:checkbox").change(function(){
$(".tckt-slctr-tbl-td-qty input:checkbox").change();
});
});'
);
}
add_action( 'wp_enqueue_scripts', 'tw_ee_ticket_selector_replace_qty_select_with_checkboxes', 11 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment