Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
$count = 0;
echo '<ul>';
foreach ( $tickets as $ticket ) {
global $product;
if ( class_exists( 'WC_Product_Simple' ) ) $product = new WC_Product_Simple( $ticket->ID );
else $product = new WC_Product( $ticket->ID );
$price = $product->get_price_html();
$link = '<a href="' . $product->get_permalink() . '">Buy!</a>';
echo "<li> $ticket->name $price $link </li>";
if ( 0 === $count )
echo '<li> There are no tickets available for this event </li>';
echo '</ul>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment