Add ticket date to email & order info

Home Forums Ticket Products Event Tickets Plus Add ticket date to email & order info

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1013571
    Matt
    Participant

    I have added the ticket date to the cart info (using your code at: https://theeventscalendar.com/knowledgebase/show-the-event-title-in-the-cart-next-to-the-ticket/ ) but I also need it on:

    – order confirmation
    – email confirmation
    – order summary in woocommerce order admin

    Do you think it’s best to add the event date to each ticket name? OR do you have some code that can achieve this?

    thanks
    Matt

    #1013671
    Brian
    Member

    Hi Matt,

    Thanks for using our plugins. I can try to help out here.

    It maybe possible to add the ticket date to those areas, but that is all in WooCommerce and I do not have any information on customizing their product.

    It maybe easier to just add it to the title.

    Or you could search for customization in WooCommerce to try and add it to these places.

    We are limited in helping that, but could try to answer a question or two.

    Let me know.

    Thanks

    #1016484
    Matt
    Participant

    I have found the code to insert information into the cart (see below) but all I need is the SQL query or PHP code to pull the date for an event from the database?

    Can you point me in the right direction? (eG: tablename, fieldname etc..)?

    thanks

    Matt.

    /*
    * The Events Calendar – WooCommerce Tickets – Add Event Title to Product Title
    * add coding to theme’s functions.php
    * @version 3.12
    */
    add_filter( ‘woocommerce_product_title’, ‘tribe_add_event_title_to_tickets_title’, 10 , 2 );
    function tribe_add_event_title_to_tickets_title( $title, $product ) {
    $product_id = $product->id;

    $event_id = get_post_meta($product_id , ‘_tribe_wooticket_for_event’, true );
    $event_date = “”; // GET THE DATE FROM THE DB
    $event_title = ”;
    if ( $event_id ) {
    $event_title = ‘ – ‘ . get_the_title( $event_title ) . ‘(‘.$event_date.’)’;
    }

    return $title . $event_title;

    }

    #1016488
    Matt
    Participant

    I have now fixed this: using a combination of your snippet and a function called tribe_get_start_date($event_id,true,””,null);

    here is my code which I included into functions.php

    but now I need to edit the final email template which sends out the tickets?

    Any ideas?

    add_filter( ‘woocommerce_cart_item_name’, ‘woocommerce_cart_item_name_event_title’, 10, 3 );
    function woocommerce_cart_item_name_event_title( $title, $values, $cart_item_key ) {
    $ticket_meta = get_post_meta( $values[‘product_id’] );
    $event_id = absint( $ticket_meta[‘_tribe_wooticket_for_event’][0] );
    $event_date = tribe_get_start_date($event_id,true,””,null);
    //var_dump($ticket_meta);

    if ( $event_id ) {

    $title = sprintf( ‘%s for %s (‘.$event_date.’)’, $title, get_permalink( $event_id ), $event_title);
    }
    return $title;
    }

    #1016561
    Brian
    Member

    Hi,

    Glad you are getting closer.

    The ticket email template is located here:

    plugins/wootickets/src/views/wootickets/tickets.php

    And you can move it to your theme and edit it there following our themer’s guide:

    https://theeventscalendar.com/knowledgebase/themers-guide/

    Is that what you are looking for?

    #1022113
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Add ticket date to email & order info’ is closed to new replies.