Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_event_reports_link( int $post_id, bool $url_only = false )
Links to sales report for all tickets for this event.
Contents
Parameters
- $post_id
-
(int) (Required) The post id.
- $url_only
-
(bool) (Optional) Whether to return the URL only.
Default value: false
Return
(string)
Source
File: src/Tribe/Commerce/WooCommerce/Main.php
public function get_event_reports_link( $post_id ) {
$ticket_ids = (array) $this->get_tickets_ids( $post_id );
if ( empty( $ticket_ids ) ) {
return '';
}
$query = array(
'post_type' => 'tribe_events',
'page' => 'tickets-orders',
'event_id' => $post_id,
);
$report_url = add_query_arg( $query, admin_url( 'admin.php' ) );
/**
* Filter the Event Ticket Orders (Sales) Report URL
*
* @param string Report URL
* @param int Event ID
* @param array Ticket IDs
*
* @return string
*/
$report_url = apply_filters( 'tribe_events_tickets_report_url', $report_url, $post_id, $ticket_ids );
return '<small> <a href="' . esc_url( $report_url ) . '">' . esc_html__( 'Event sales report', 'event-tickets-plus' ) . '</a> </small>';
}
Changelog
| Version | Description |
|---|---|
| 5.9.0 | Introduced. |