Tribe__Tickets_Plus__Commerce__EDD__Main::do_metabox_capacity_options( int $post_id, int $ticket_id )
Add the extra options in the admin’s new/edit ticket metabox
Contents
Parameters
- $post_id
-
(int) (Required)
- $ticket_id
-
(int) (Required)
Return
(void)
Source
File: src/Tribe/Commerce/EDD/Main.php
public function do_metabox_capacity_options( $post_id, $ticket_id ) {
$is_correct_provider = tribe( 'tickets.handler' )->is_correct_provider( $post_id, $this );
$url = $stock = $sku = '';
$global_stock_mode = tribe( 'tickets.handler' )->get_default_capacity_mode();
$global_stock_cap = 0;
$capacity = null;
$event_capacity = null;
$stock_object = new Tribe__Tickets__Global_Stock( $post_id );
if ( $stock_object->is_enabled() ) {
$event_capacity = tribe_tickets_get_capacity( $post_id );
}
if ( ! empty( $ticket_id ) ) {
$ticket = $this->get_ticket( $post_id, $ticket_id );
$is_correct_provider = tribe( 'tickets.handler' )->is_correct_provider( $ticket_id, $this );
if ( ! empty( $ticket ) ) {
$stock = $ticket->managing_stock() ? $ticket->stock() : '';
$sku = get_post_meta( $ticket_id, '_sku', true );
$capacity = tribe_tickets_get_capacity( $ticket->ID );
$global_stock_mode = $ticket->global_stock_mode();
$global_stock_cap = $ticket->global_stock_cap();
}
}
// Bail when we are not dealing with this provider
if ( ! $is_correct_provider ) {
return;
}
include $this->plugin_path . 'src/admin-views/edd-metabox-capacity.php';
}
Changelog
| Version | Description |
|---|---|
| 4.6 | Introduced. |