Adding Event Date to Woocommerce

Home Forums Calendar Products Events Calendar PRO Adding Event Date to Woocommerce

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1140322
    Sheldon
    Participant

    Hi There,

    We’ve almost completed setup of our site with Events Calendar PRO, Tickets PRO and Woocommerce checkout. This is for a comedy club website, where there are 1 – 2 shows per day, with differing ticket prices per show.

    Everything is setup correctly and we have the showtime and price setup for each individual ticket offered per daily event, however when I click on a ticket and continue into the WooCommerce flow, it only displays the showtime and price for the ticket, but not the event date. http://d.pr/i/1cGqa

    This is problematic as the user clicks into their cart, but might not be sure what tickets are for what nights: http://d.pr/i/12gZK

    I know I could probably add the date to the ticket description for each ticket, but I’m wondering if there is an easier way to get this date into the templates, from a code perspective. I also know you probably don’t provide much support on the WooCommerce side, but any direction / help would be appreciated!

    Thanks.

    #1141012
    Nico
    Member

    Hi Sheldon,

    Thanks for reaching out to us! Interesting question, as you already know we cannot provide much support on the Woo side of things but we can give this a try ๐Ÿ˜‰

    Try pasting this snippet in your functions.php file:


    /* Add event date to Woo Cart */
    function tribe_show_event_date_cart ( $item_data, $cart_item ) {

    if ( ! class_exists('Tribe__Tickets_Plus__Commerce__WooCommerce__Main') ) return $item_data;

    $tickets = Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance();

    $event_id = get_post_meta( $cart_item['product_id'], $tickets->event_key, true );

    if ( ! empty( $event_id ) ) {
    $item_data[] = array(
    'key' => 'Date',
    'value' => tribe_get_start_time ( $event_id, tribe_get_date_format() )
    );
    }

    return $item_data;
    }

    add_filter ( 'woocommerce_get_item_data', 'tribe_show_event_date_cart', 10, 2 );

    Also, please note that tickets still don’t support recurring events!

    Please let me know if the snippet works as expected,
    Best,
    Nico

    #1141247
    Sheldon
    Participant

    This reply is private.

    #1141276
    Nico
    Member

    Wooot! Stocked to hear Sheldon ๐Ÿ™‚

    Iโ€™ll go ahead and close out this thread, but if you need help with anything else please donโ€™t hesitate to create a new one and we will be happy to assist you.

    Hope you have a great week,
    Nico

    #1149529
    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 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Adding Event Date to Woocommerce’ is closed to new replies.