martybeckers

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: WooCommerce Tickets and the WooCommerce Waitlist plugin #858107
    martybeckers
    Participant

    I found a workaround and here are the steps to get the “Events Calendar Pro” and “WooCommerce Tickets” plugins to work properly with the “WooCommerce Waitlist” plugin (note that the line numbers will likely change with future versions):

    1. Copy wp-content/plugins/wootickets/views/wootickets/tickets.php to wp-content/themes/[your theme]/tribe-events/wootickets/tickets.php so that it can be customized without breaking the plugin updates

    2. Edit wp-content/themes/[your theme]/tribe-events/wootickets/tickets.php and change line 59 from just an “Out of stock” message to a “Join the waitlist” button:
    echo ‘<span class=”tickets_nostock” style=”padding?top: 10px;”><b>SOLD OUT: </b>get_permalink() .'” class=”banner_button”>Join the waitlist</span>’;

    3. When the product is out of stock, the user will be able to press the button to go to the normal WooCommerce product page for the event, which has the waitlist feature. Unfortunately, that might be confusing because the user goes from one event page to another, so the solution is to customize the layout of the WooCommerce product page when the product is a ticket. To do that, copy wp-content/plugins/woocommerce/templates/single-product.php to wp-content/themes/[your theme]/woocommerce/single-product.php, then replace this:
    <?php wc_get_template_part( ‘content’, ‘single-product’ ); ?>
    with this:
    if( has_term( ‘ticket’, ‘product_cat’ )) {
    wc_get_template_part( ‘content’, ‘single-product-ticket’ );
    } else{
    wc_get_template_part( ‘content’, ‘single-product’ );
    }

    4. Then to create the new customized layout for the event ticket page, copy wp-content/plugins/woocommerce/templates/content-single-product.php to wp-content/themes/[your theme]/woocommerce/content-single-product-ticket.php, and customize the layout however you like so that it is clear the page is just for joining the mailing list. As a suggestion, comment-out this line:
    // do_action( ‘woocommerce_before_single_product_summary’ );
    Then add code like this below that line to redirect to the product when it isn’t out of stock, or display a message above the field for joining the mailing list when it is out of stock:
    $id = get_the_ID();
    $wootickets = TribeWooTickets::get_instance();
    $event_id = get_post_meta(get_the_ID(), $wootickets->event_key, true );
    $event = get_post($event_id);
    global $product;
    $availability = $product->get_availability();
    if ($availability[‘class’] == ‘in-stock’) : ?>
    <div class=”waitlist-message”>
    <script type=”text/javascript”>window.location.replace(“<?php echo site_url().’/event/’.$event->post_name; ?>”);</script>
    </div>
    <?php else : ?>
    <div class=”waitlist-message”>
    <h1>Join the Waitlist for:</h1>
    <h2>post_name; ?>”> <?php echo $event->post_title; ?> </h2>
    <p>Thank you so much for your interest! Enter your email address below, and we’ll let you know if a spot opens up for this event.</p>
    </div>
    <?php endif; ?>

    The end result is the expected waitlist functionality – when an event is sold out, a “Join the waiting list” button will go to a new page where the user can enter their email address, then they will be sent an email with a link to the event automatically when a ticket becomes available.

    Ideally this change will just be made to the WooCommerce Tickets plugin in a future version so that it works with the WooCommerce Waitlist plugin out of the box, but this workaround will solve the problem in the meantime.

Viewing 1 post (of 1 total)