Created
July 23, 2015 20:49
-
-
Save theeventscalendar/eedc81ba148e0346dfee to your computer and use it in GitHub Desktop.
Alternate ticket form example snippet. See https://theeventscalendar.com/knowledgebase/selling-tickets-from-the-woocommerce-products-page/.
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 | |
$count = 0; | |
echo '<ul>'; | |
foreach ( $tickets as $ticket ) { | |
global $product; | |
$count++; | |
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