Support

Home Forums Event Espresso Premium Correct Way to Modify Ticket Selector to replace Cart button with Waitlist?

Correct Way to Modify Ticket Selector to replace Cart button with Waitlist?

Posted: November 14, 2018 at 4:16 am


lhammond

November 14, 2018 at 4:16 am

I have been reading the various support articles about how to modify the ticket selector and now I am confused about which way is the correct way with the most recent version of EE4. I looked at https://eventespresso.com/topic/customize-ticket-selector/ and am not quite sure how to use that hook for the row details. I have also looked at the detailed template at https://gist.github.com/lorenzocaum/480f7ec40fdae45619ee but I think it is not really recommended that we override all the logic in that way?

What I want to do is display only the quantity drop-down and the Add to Cart button with no other details, or if it is sold out, the Waitlist button in it’s place.

What I have now is the standard ticket selector and I’m using CSS to hide most of what I don’t need to see. However, I don’t want the quantity drop-down and the submit button in separate table rows, but rather side-by-side. And when there is a wait list, I want the button for it to show *in* the table (or in the same place as the other button) in place of the Sold Out indication, rather than below the table in a separate form.

What is the best way to make this happen so that I don’t break future plugin updates but get the custom behavior I need?


Josh

  • Support Staff

November 15, 2018 at 2:47 pm

Hi,

There are some limits to what can be customized there, but one way you could make some customizations and avoid breaking things is by injecting a bit of custom JavaScript/jQuery onto the page. There are a number of jQuery methods that work well to move elements around and conditionally hide other elements.

You can load the custom script to the page by using the wp_add_inline_script() function, like this:

add_action(
 'wp_enqueue_scripts', 
 'my_add_inline_script_eets', 
 20
);
function my_add_inline_script_eets() {
    $custom_js = '
    jQuery(document).ready(function($){
        // custom JavaScript code goes here
    });';
    wp_add_inline_script('ticket_selector', $custom_js);
}

The support post ‘Correct Way to Modify Ticket Selector to replace Cart button with Waitlist?’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso