TAO

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: Wrong ticket_id in email template #1337229
    TAO
    Participant

    Hi Victor,

    Apologies, I was actually looking at the wrong thing. The ticket_id is correct, but the _tribe_wooticket_order_item which is saved as meta value for that ticket is incorrect.

    This happens with either this code:

    $wooticket = get_posts( array(
    		'post_type'      => 'tribe_wooticket',
    		'meta_key'       => '_unique_id',
    		'meta_value'     => $ticket['ticket_id'],
    		'posts_per_page' => 1
    	) );
    
    if ( !$wooticket ) {
    	// Some more detailed error logging here.
    	error_log( 'error' );
    }
    
    $oiid = get_post_meta( $wooticket[0]->ID, '_tribe_wooticket_order_item', true ); // <-- this is where I get the wrong value
    
    $oi = new WC_Order_Item_Product( $oiid );

    and also with this:
    $oi = new WC_Order_Item_Product( $ticket['order_item_id'] );

    (all being inside the [theme]/tribe-events/tickets/email.php template)
    ($ticket in both cases is one element of the $tickets[] array provided to the template by event tickets plus)

    Workflow to reproduce this issue 100%:

    1. Add ticket to cart
    2. Checkout to PayPal
    3. Cancel on the PayPal site, get redirected to shopping cart
    4. Checkout to PayPal again
    5. Complete Paypal Payment

    I always get an ID that’s too low (594 when it should be 596)

Viewing 1 post (of 1 total)