Tribe__Tickets__Commerce__PayPal__Main::get_price_html( int|object $product, array|boolean $attendee = false )
Get’s the product price html
Contents
Parameters
- $product
-
(int|object) (Required)
- $attendee
-
(array|boolean) (Optional)
Default value: false
Return
(string)
Source
File: src/Tribe/Commerce/PayPal/Main.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 = get_post_meta( $product_id, '_price', true );
$price = tribe( 'tickets.commerce.paypal.currency' )->format_currency( $price, $product_id );
$price_html = '<span class="tribe-tickets-price-amount amount">' . esc_html( $price ) . '</span>';
/**
* Allow filtering of the Price HTML
*
* @since 4.7
*
* @param string $price_html
* @param mixed $product
* @param mixed $attendee
*
*/
return apply_filters( 'tribe_tickets_tpp_ticket_price_html', $price_html, $product, $attendee );
}
Changelog
| Version | Description |
|---|---|
| 4.7 | Introduced. |