Created
November 20, 2014 15:36
-
-
Save anonymous/8630272906cc46642199 to your computer and use it in GitHub Desktop.
workshop_attendee_info($id)
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
// This is all I have so far. I can cycle through the items of the order | |
// and pick out the id's of products that ARE tickets, but I need to | |
// get the event ID from the ticket item somehow so I can display event info | |
function workshop_attendee_info($id) | |
{ | |
$order = new WC_Order($id); | |
$items = $order->get_items(); | |
$tickets = array(); | |
$info = ""; | |
foreach ( $items as $item_id => $item ) | |
{ | |
$product_id = $item['product_id']; | |
$product = get_product($product_id); | |
$terms = wp_get_post_terms( $product_id, 'product_cat' ); | |
$categories = []; | |
if(!is_wp_error($terms)) | |
{ | |
foreach ( $terms as $term ) | |
{ | |
$categories[] = $term->slug; | |
} | |
if ( in_array( 'ti', $categories ) ) | |
{ | |
// $tickets[] = new_ticket_object(); | |
} | |
} | |
} | |
if(count($tickets) > 0) | |
{ | |
$info = "<tr><td valign='top' width='100%' colspan='2'><h3>Workshop Attendees</h3>"; | |
// Loop through tickets, adding needed meta to $info | |
$info .= "</td></tr>"; | |
} | |
return $info; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment