Created
July 28, 2017 02:46
-
-
Save vicskf/ce7ed3178099cc91a96ea4c805cf8af1 to your computer and use it in GitHub Desktop.
Add venue name to WooCommerce order item if it's a tribe ticket
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'woocommerce_order_item_meta_start', 'add_venue_to_order', 101, 4 ); | |
function add_venue_to_order( $item_id, $item, $order, $plain_text = '' ){ | |
$wootix = Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance(); | |
$item_data = $item->get_data(); | |
$event = $wootix->get_event_for_ticket( $item_data['product_id'] ); | |
//get event venue | |
$event_venue = tribe_get_venue( $event ); | |
// Show event Venue Name if this ticket is for a tribe event. | |
if ( ! empty( $event ) ) { | |
echo 'Venue: ' . $event_venue; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment