Orders::add_orders_row_action( array $actions,  $post )

Adds order related actions to the available row actions for the post.


Parameters

$actions

(array) (Required)

$post

(Required)


Top ↑

Return

(array)


Top ↑

Source

File: src/Tickets/Commerce/Reports/Orders.php

	public function add_orders_row_action( array $actions, $post ) {
		$post_id = \Tribe__Main::post_id_helper( $post );
		$post    = get_post( $post_id );

		// only if tickets are active on this post type
		if ( ! in_array( $post->post_type, Plugin::instance()->post_types(), true ) ) {
			return $actions;
		}
		$commerce = tribe( Module::class );

		if ( ! $commerce->post_has_tickets( $post ) ) {
			return $actions;
		}

		$url         = $commerce->get_event_reports_link( $post->ID, true );
		$post_labels = get_post_type_labels( get_post_type_object( $post->post_type ) );
		$post_type   = strtolower( $post_labels->singular_name );

		$actions['tickets_orders'] = sprintf(
			'<a title="%s" href="%s">%s</a>',
			sprintf( esc_html__( 'See Tickets Commerce purchases for this %s', 'event-tickets' ), $post_type ),
			esc_url( $url ),
			esc_html__( 'Orders', 'event-tickets' )
		);

		return $actions;
	}

Top ↑

Changelog

Changelog
Version Description
5.2.0 Introduced.