Skip to content

Commit

Permalink
Add filter to modify the virtual inventory contents for an event.
Browse files Browse the repository at this point in the history
  • Loading branch information
joedolson committed Dec 5, 2024
1 parent e25d71f commit cf8dce8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/mt-cart-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,18 @@ function mt_check_inventory( $event_id, $type = '', $virtual = 'auto' ) {
if ( 'virtual' === $is_virtual && ( 'auto' === $virtual || true === $virtual ) ) {
// Virtual inventory holds tickets in carts but not yet sold.
$virtual_inventory = get_post_meta( $event_id, '_mt_virtual_inventory', true );
/**
* Filter the virtual inventory array.
*
* @hook mt_virtual_inventory
*
* @param {array} $virtual_inventory Contents of the virtual inventory.
* @param {int} $event_id Current Event ID.
* @param {array} $registration Event registration configuration.
*
* @return {array}
*/
$virtual_inventory = apply_filters( 'mt_virtual_inventory', $virtual_inventory, $event_id, $registration );
if ( '' !== $type ) {
$current_virtual = isset( $virtual_inventory[ $type ] ) ? $virtual_inventory[ $type ] : 0;
} else {
Expand Down

0 comments on commit cf8dce8

Please sign in to comment.