• Resolved neilmaynard

    (@neilmaynard)


    I have this code to display start date of the event. But what I always get is the published date. I guess there’s something wrong on the tribe_get_start_date, but I don’t know what is it. Any help is very much appreciated.

    function tribe_add_date_to_order_title( $title, $item ) {
     
    $event = tribe_events_get_ticket_event( $item['product_id'] );
     
    if ( $event !== false ) {
    $title .= ' - ' . tribe_get_start_date( $event );
    }
     
    return $title;
    }
     
    add_filter( 'woocommerce_order_item_name', 'tribe_add_date_to_order_title', 100, 2 );
    • This topic was modified 6 years, 5 months ago by neilmaynard.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey there. Just looking at your code, I see one thing that might be the problem. The tribe_get_start_date() function is looking for an integer. You’re passing $event, which seems to be a WP_Post object.

    Here’s teh doc:
    https://theeventscalendar.com/function/tribe_get_start_date/

    Try using this, instead:
    $title .= ' - ' . tribe_get_start_date( $event->ID );

    Let me know how that works out.

    Mike

    Hey there,

    Since this topic has been inactive for a while, I’m going to go ahead and mark as resolved. Don’t hesitate to reopen or create a new topic if you still need help! ??

    Take care,
    Ed ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘tribe_get_start_date shows the published date not the event date’ is closed to new replies.