Ticket::get_price_html( int|object $product, array|boolean $attendee = false )
Returns the ticket price html template
Contents
Parameters
- $product
-
(int|object) (Required) The ticket post ID or object.
- $attendee
-
(array|boolean) (Optional) The attendee data.
Default value: false
Return
(string)
Source
File: src/Tickets/Commerce/Ticket.php
public function get_price_html( $product, $attendee = false ) {
$product_id = $product;
if ( $product instanceof \WP_Post ) {
$product_id = $product->ID;
} elseif ( is_numeric( $product_id ) ) {
$product = get_post( $product_id );
} else {
return '';
}
$price = Price::to_currency( Price::to_string( $this->get_price_value( $product ) ) );
$price_html = '<span class="tribe-tickets-price-amount amount">' . esc_html( $price ) . '</span>';
/**
* Allow filtering of the Price HTML
*
* @since 5.1.9
*
* @param string $price_html
* @param mixed $product
* @param mixed $attendee
*
*/
return apply_filters( 'tec_tickets_commerce_ticket_price_html', $price_html, $product, $attendee );
}
Changelog
| Version | Description |
|---|---|
| 5.9.0 | Updated sale price template arguments. |
| 5.1.9 | Introduced. |