Show event name in Basket & Checkout

Home Forums Ticket Products Event Tickets Plus Show event name in Basket & Checkout

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1196120
    Patrick Hathaway
    Participant

    We use ETP and WooCommerce.

    If we add tickets to an Event, when you add a ticket(s) to the basket, rather than showing the event name it just says the ticket name.

    Is there a way to add the event name as well?

    #1196502
    Andras
    Keymaster

    Hello jammycustard,

    Great question! It’s not possible out of the box, but there is this snippet I hear of. 🙂

    Paste the following snippet into your child theme’s functions.php file:

    /**
    * Example for adding event data to WooCommerce checkout for Events Calendar tickets.
    * @link http://theeventscalendar.com/support/forums/topic/event-title-and-date-in-cart/
    */
    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 %s', $title, get_permalink( $event_id ), get_the_title( $event_id ) );
    }
    return $title;
    }

    This is the before and after screenshot:

    Before snippet → https://cloudup.com/c5yeg9Horu0

    After snippet → https://cloudup.com/cz-EbDJJ10z

    Let me know if this helps.

    Cheers,
    Andras

    #1196672
    Patrick Hathaway
    Participant

    Worked a treat! Thank you very much.

    #1197029
    Andras
    Keymaster

    Hey jammycustard,

    Great, glad it helped! I am going to go ahead and close this ticket, but if you need help on this or something else, don’t hesitate to open a new topic.

    Cheers and happy thanksgiving,
    Andras

    PS: If you like our plugin, and you didn’t yet do so 🙂 we would be happy to receive a review in the wordpress.org repository. Thanks!
    https://wordpress.org/support/view/plugin-reviews/the-events-calendar

    PS2: We’d be also grateful if you would give us feedback on your satisfaction with support. Just click on one of the classy looking emojis below. 🙂 If you can spare a few words, that’s even better. Doublethanks!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Show event name in Basket & Checkout’ is closed to new replies.