Event title with ticket name

Home Forums Ticket Products Event Tickets Plus Event title with ticket name

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #954164
    Joe
    Participant

    Hi,

    how to show Event title with ticket name in the tickets listing.
    Also, how to show it in the woocommerce cart after you add some ticket.
    for example:
    Event A
    ticket name: B
    If you add ticket “B” to to cart you will get “B” in the cart list so you dont know to which Event it belongs.

    Thank you
    Sinisa

    #954314
    Geoff
    Member

    Hi ther, Joe! Thanks for getting in touch and welcome to the forums. 🙂

    Good question. I believe you would need to modify the appropriate WooCommerce templates for a single product page and the cart, then add the event title to the loops in those templates. Something like:

    <?php echo tribe_get_events_title() ?>

    That should grab the event title for the related ticket and display it in the loop.

    Will this work for you? Please let me know. 🙂

    Cheers!
    Geoff

    #954352
    Geoff
    Member

    Hey Joe, I was actually talking about this with a colleague and he offered a pretty nice solution that might work for you here.

    Adding this snippet to your functions.php file should take take care of adding the event name next to a ticket in the shopping cart:

    /**
    Example for adding event data to WooCommerce checkout for Events Calendar tickets.
    */
    
    add_filter( 'woocommerce_cart_item_name', 'example_testing', 10, 3 );
    
    function example_testing( $title, $values, $cart_item_key ) {
    $ticket_meta = get_post_meta( $values['product_id'] );
    $event_id = absint( $ticket_meta['_tribe_wooticket_for_event'][0] );
    
    if ( $event_id ) {
    $title = sprintf( '%s for <a href="%s" target="_blank"><strong>%s</strong></a>', $title, get_permalink( $event_id ), get_the_title( $event_id ) );
    }
    
    return $title;
    }

    Try giving that a shot to see if it helps in this case. 🙂

    Geoff

    #954359
    Joe
    Participant

    Thanks Geoff, i did it with filter similar what you wrote.

    #954408
    Geoff
    Member

    Fantastic and nice work! Thanks for following up and confirming.

    I’ll go ahead and close this thread, but please feel free to open a new one if any other questions pop up–we’d be happy to help. 🙂

    Geoff

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Event title with ticket name’ is closed to new replies.