Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SL-253] Update seating availability calculation depending on seat reservation. #3461

Open
wants to merge 83 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
ceeac15
added new filter method
rafsuntaskin Dec 5, 2024
50ee94c
replace usages
rafsuntaskin Dec 5, 2024
7a2089e
fix return cast
rafsuntaskin Dec 5, 2024
f62e70a
apply filter for seating attendees
rafsuntaskin Dec 6, 2024
5080366
filter by reservation meta
rafsuntaskin Dec 6, 2024
dc364b3
call stock method once
rafsuntaskin Dec 6, 2024
a985564
skip non reservation attendee from attendee counts
rafsuntaskin Dec 9, 2024
c379837
sync total sales with new attendee count
rafsuntaskin Dec 9, 2024
afaeaa2
skip non reservation attendees from count
rafsuntaskin Dec 9, 2024
df2bf5e
added stock filter
rafsuntaskin Dec 9, 2024
db44468
WIP: stock meta read filter
rafsuntaskin Dec 9, 2024
b4bad76
Merge branch 'release/T24.hydra' into feat/sl-253-calc-seating-availa…
rafsuntaskin Dec 9, 2024
66a7302
WIP: revert stock filter
rafsuntaskin Dec 9, 2024
9367a20
Fixed casting bug with inarray check
rafsuntaskin Dec 10, 2024
ccab1e5
Filter stock with seating inventory
rafsuntaskin Dec 11, 2024
50342a7
cache stock filter
rafsuntaskin Dec 11, 2024
7f24748
Merge branch 'release/T24.hydra' into feat/sl-253-calc-seating-availa…
rafsuntaskin Dec 11, 2024
b7996e3
update doc block
rafsuntaskin Dec 11, 2024
02f88e2
updated filter doc block
rafsuntaskin Dec 11, 2024
e5f80f8
tests updated attendee meta
rafsuntaskin Dec 11, 2024
09ef598
tests updated more meta
rafsuntaskin Dec 12, 2024
752f873
updated more tests
rafsuntaskin Dec 12, 2024
4881358
tests - avoid direct stock meta check
rafsuntaskin Dec 12, 2024
65bb792
tests - fix attendees fetch
rafsuntaskin Dec 12, 2024
c3833ab
tests - add deletion mock
rafsuntaskin Dec 12, 2024
96f2308
fixed stock count filter
rafsuntaskin Dec 12, 2024
50fb64f
tests- updated attendee meta
rafsuntaskin Dec 12, 2024
1e5da35
tests - fix attendee meta update
rafsuntaskin Dec 13, 2024
961f4bc
Fix - remove reservation meta on layout update
rafsuntaskin Dec 13, 2024
a710373
Tests - adjusted AjaxTest with new updates
rafsuntaskin Dec 13, 2024
13a3bfa
Tests - adjusted EditorTest
rafsuntaskin Dec 13, 2024
e646eb7
Tests - adjusted TimerTest
rafsuntaskin Dec 13, 2024
1d2e2c8
Tests - phpcbf
rafsuntaskin Dec 13, 2024
c4def17
tests - update SeatTypes tests where orders are placed
rafsuntaskin Dec 13, 2024
4b6a6fc
tests - update SeatTypes tests where orders are placed 2
rafsuntaskin Dec 13, 2024
dc9c9e0
tests - update SeatTypes tests where orders are placed 3
rafsuntaskin Dec 13, 2024
6dc28f2
tests - updated orders controller
rafsuntaskin Dec 16, 2024
a2a7ef8
Merge branch 'release/T24.hydra' into feat/sl-253-calc-seating-availa…
rafsuntaskin Dec 16, 2024
03aea9c
fix phpcbf
rafsuntaskin Dec 16, 2024
90197f6
Merge branch 'release/T24.hydra' into feat/sl-253-calc-seating-availa…
rafsuntaskin Dec 16, 2024
5d978c4
Version bump for release/T24.imp
codingmusician Dec 16, 2024
f0fd943
fixed total sales update
rafsuntaskin Dec 16, 2024
41f2fe2
Merge branch 'release/T24.hydra' into feat/sl-253-calc-seating-availa…
rafsuntaskin Dec 17, 2024
ab8636c
phpcbf
rafsuntaskin Dec 17, 2024
86f3dae
tests - new scenario added to cover removal of reservations
rafsuntaskin Dec 17, 2024
ad2a57f
changelog added
rafsuntaskin Dec 17, 2024
d4228a6
simplified logic
rafsuntaskin Dec 17, 2024
a380442
Merge branch 'release/T24.hydra' into feat/sl-253-calc-seating-availa…
rafsuntaskin Dec 17, 2024
b5d4640
update snapshot
codingmusician Dec 17, 2024
135e4ee
update snapshot
codingmusician Dec 17, 2024
2270287
fix snapshot
codingmusician Dec 17, 2024
7b95169
fix snapshot
codingmusician Dec 17, 2024
2fbf3a9
remove min
codingmusician Dec 17, 2024
e0bddfa
fix logic
codingmusician Dec 17, 2024
aaf8ad2
update tests
codingmusician Dec 17, 2024
6a337b3
Merge pull request #3458 from the-events-calendar/task/version-bump-r…
codingmusician Dec 17, 2024
2fdd1af
Merge branch 'master' into release/T24.imp
Camwyn Dec 18, 2024
cb7f745
Merge branch 'master' into feat/sl-253-calc-seating-availablity
rafsuntaskin Dec 18, 2024
099ee52
Update src/Tribe/Tickets.php
rafsuntaskin Dec 18, 2024
5fdeef6
Merge remote-tracking branch 'origin/release/T25.imp' into fix/ET-227…
codingmusician Dec 18, 2024
1c12e97
changelog
codingmusician Dec 18, 2024
8eeff0c
spacing fix
codingmusician Dec 18, 2024
79bc8da
update doc
codingmusician Dec 18, 2024
3973892
typo
codingmusician Dec 18, 2024
bb8e1b3
update wp version in tests
codingmusician Dec 18, 2024
03da5d8
update snapshot
codingmusician Dec 18, 2024
fc12e3f
Merge pull request #3462 from the-events-calendar/fix/ET-2273-et-remo…
codingmusician Dec 18, 2024
c7b371e
Added an empty array as a default value for foreign key check.
sdokus Dec 20, 2024
d6b3ca7
Prevent aggressive hook update
dpanta94 Dec 20, 2024
68022a2
Merge branch 'release/T25.imp' into fix/revert-aggresive-hook-update
dpanta94 Dec 20, 2024
72153ac
Fix ft_smoketest suite
dpanta94 Dec 20, 2024
149a1d0
Fix wpunit suite
dpanta94 Dec 20, 2024
14ad43b
added changelog
dpanta94 Dec 20, 2024
09aae6f
Merge pull request #3465 from the-events-calendar/fix/revert-aggresiv…
lucatume Dec 20, 2024
4a9cfd9
Merge branch 'release/T25.imp' into fix/ET-2275-maybe-disable-foreign…
sdokus Dec 20, 2024
23f67f7
Added safeguards to avoid warnings
sdokus Dec 20, 2024
3f75498
Revised phrasing of if conditional
sdokus Dec 20, 2024
6749b2f
Merge pull request #3464 from the-events-calendar/fix/ET-2275-maybe-d…
sdokus Dec 20, 2024
53d9a8d
Merge branch 'release/T25.imp' into feat/sl-253-calc-seating-availablity
rafsuntaskin Dec 21, 2024
01d0dbb
moved filter to main method
rafsuntaskin Dec 24, 2024
8d03ebd
revert new metho usages
rafsuntaskin Dec 24, 2024
72f1a4a
apply new filter for ticketscommerce
rafsuntaskin Dec 24, 2024
dfa5bb7
removed old overrride method
rafsuntaskin Dec 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog/feat-sl-253-calc-seating-availablity
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: feat

Seated tickets stock now calculated from attendee reservation count. [SL-253]
4 changes: 4 additions & 0 deletions changelog/fix-ET-2273-et-removing-screen-options
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: fix

Screen options will no longer be disabled when Event Tickets is active. [ET-2273]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: fix

Added a default empty array to `maybe_disable_foreign_key_checks`. [ET-2275]
4 changes: 4 additions & 0 deletions changelog/fix-revert-aggresive-hook-update
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: fix

Reverts aggressive hook update, causing fatals on installtion with themes overwritting the template `Single Ticket Item`. [ET-2276]
8 changes: 6 additions & 2 deletions src/Tickets/Admin/Tickets/Screen_Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,18 @@ public function add_hooks() {
* Filters the screen options show screen.
*
* @since 5.14.0
* @since TBD Fixed show screen options logic.
*
* @param boolean $show Whether to show the screen options.
* @param WP_Screen $screen The current screen.
*
* @return boolean
*/
public function filter_screen_options_show_screen( $show, $screen ) {
$show = ! empty( $screen ) && Page::$hook_suffix === $screen->id;
// Only show the screen options on the Tickets screen, otherwise bail.
if ( empty( $screen ) || Page::$hook_suffix !== $screen->id ) {
return $show;
}

/**
* Filter the screen options show screen.
Expand All @@ -62,7 +66,7 @@ public function filter_screen_options_show_screen( $show, $screen ) {
*
* @param boolean $show Whether to show the screen options.
*/
return apply_filters( 'tec_tickets_admin_tickets_screen_options_show_screen', $show );
return apply_filters( 'tec_tickets_admin_tickets_screen_options_show_screen', true );
}

/**
Expand Down
7 changes: 6 additions & 1 deletion src/Tickets/Commerce/Attendee.php
Original file line number Diff line number Diff line change
Expand Up @@ -628,11 +628,16 @@ public function registration_cart_provider( $provider_obj, $provider ) {
*
* @since 5.1.9
*
* @param bool $decreases_inventory Whether the attendee decreases inventory or not.
* @param array $attendee array of attendee information.
*
* @return bool
*/
public function decreases_inventory( $attendee ) {
public function decreases_inventory( $decreases_inventory, $attendee ) {
if ( Module::class !== $attendee['provider'] ) {
return $decreases_inventory;
}

$attendee = tec_tc_get_attendee( $attendee['ID'] );
$order = tec_tc_get_order( $attendee->post_parent );
$statuses = array_unique(
Expand Down
16 changes: 16 additions & 0 deletions src/Tickets/Commerce/Hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ protected function add_filters() {

add_filter( 'tec_tickets_all_tickets_table_provider_options', [ $this, 'filter_all_tickets_table_provider_options' ] );
add_filter( 'tec_tickets_all_tickets_table_event_meta_keys', [ $this, 'filter_all_tickets_table_event_meta_keys' ] );

add_filter( 'tec_tickets_attendee_decreases_inventory', [ $this, 'filter_attendee_decreases_inventory' ], 10, 2 );
}

/**
Expand Down Expand Up @@ -1177,4 +1179,18 @@ public function filter_all_tickets_table_event_meta_keys( $meta_keys ) {

return $meta_keys;
}

/**
* Filters if the attendee decreases inventory.
*
* @since TBD
*
* @param bool $decreases_inventory Whether the attendee decreases inventory.
* @param array $attendee The attendee data.
*
* @return bool Whether the attendee decreases inventory.
*/
public function filter_attendee_decreases_inventory( $decreases_inventory, $attendee ): bool {
return tribe( Attendee::class )->decreases_inventory( $decreases_inventory, $attendee );
}
}
18 changes: 0 additions & 18 deletions src/Tickets/Commerce/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,24 +460,6 @@ public function get_price_value( $product ) {
return tribe( Ticket::class )->get_price_value( $product );
}

/**
* Whether a specific attendee is valid toward inventory decrease or not.
*
* By default only attendees generated as part of a Completed order will count toward
* an inventory decrease but, if the option to reserve stock for Pending Orders is activated,
* then those attendees generated as part of a Pending Order will, for a limited time after the
* order creation, cause the inventory to be decreased.
*
* @since 5.1.9
*
* @param array $attendee
*
* @return bool
*/
public function attendee_decreases_inventory( array $attendee ) {
return tribe( Attendee::class )->decreases_inventory( $attendee );
}

/**
* {@inheritdoc}
*/
Expand Down
10 changes: 7 additions & 3 deletions src/Tickets/Flexible_Tickets/WP_Cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,19 @@ public function is_active(): bool {
* checks will be re-enabled after the command is run, in the `truncate_custom_tables` method.
*
* @since 5.8.0
* @since TBD Added default value and safeguards.
*
* @version TBD
*
* @param array $args The arguments passed to the WP CLI command.
*
* @return bool Whether the foreign key checks were disabled or not.
*/
public function maybe_disable_foreign_key_checks( array $args ): bool {
if ( ! ( $args[0] === 'site' && $args[1] === 'empty' ) ) {
public function maybe_disable_foreign_key_checks( array $args = [] ): bool {
if ( empty( $args[0] ) || 'site' !== $args[0] || empty( $args[1] ) || 'empty' !== $args[1] ) {
return false;
}

global $wpdb;
$wpdb->query( 'SET FOREIGN_KEY_CHECKS=0;' );

Expand All @@ -87,4 +91,4 @@ public function maybe_disable_foreign_key_checks( array $args ): bool {
public function truncate_custom_tables(): int {
return $this->container->make( Custom_Tables::class )->truncate_tables();
}
}
}
3 changes: 2 additions & 1 deletion src/Tickets/Seating/Admin/Ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,8 @@ public function update_event_layout() {

foreach ( $attendees as $attendee_id ) {
update_post_meta( $attendee_id, Meta::META_KEY_SEAT_TYPE, $new_seat_type_id );
update_post_meta( $attendee_id, Meta::META_KEY_ATTENDEE_SEAT_LABEL, '' );
delete_post_meta( $attendee_id, Meta::META_KEY_ATTENDEE_SEAT_LABEL );
delete_post_meta( $attendee_id, Meta::META_KEY_RESERVATION_ID );

++$updated_attendees;
}
Expand Down
4 changes: 4 additions & 0 deletions src/Tickets/Seating/Commerce/Attendees.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ public function get_count_by_post_seat_type( int $post_id, string $seat_type ):
AND attendee_for_event.meta_key in ({$attendee_to_event_meta_keys_in})
JOIN %i AS attendee_for_ticket ON attendee.ID = attendee_for_ticket.post_id
AND attendee_for_ticket.meta_key in ({$attendee_to_ticket_meta_keys_in})
JOIN %i AS attendee_reservation_meta ON attendee.ID = attendee_reservation_meta.post_id
AND attendee_reservation_meta.meta_key = %s
WHERE attendee.post_type IN ({$attendee_types_in})
AND attendee.post_status != 'trash'
AND attendee_for_event.meta_value = %d
Expand All @@ -93,6 +95,8 @@ public function get_count_by_post_seat_type( int $post_id, string $seat_type ):
$wpdb->posts,
$wpdb->postmeta,
$wpdb->postmeta,
$wpdb->postmeta,
Meta::META_KEY_RESERVATION_ID,
$post_id,
$wpdb->posts,
$wpdb->postmeta,
Expand Down
56 changes: 50 additions & 6 deletions src/Tickets/Seating/Commerce/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use Tribe__Tickets__Tickets as Tickets;
use Tribe__Tickets__Tickets_Handler as Tickets_Handler;
use WP_Post;
use Tribe__Cache_Listener as Triggers;

/**
* Class Controller.
Expand Down Expand Up @@ -104,6 +105,7 @@ protected function do_register(): void {
add_filter( 'update_post_metadata', [ $this, 'handle_ticket_meta_update' ], 10, 4 );
add_action( 'before_delete_post', [ $this, 'restock_ticket_on_attendee_deletion' ], 10, 2 );
add_action( 'wp_trash_post', [ $this, 'restock_ticket_on_attendee_trash' ] );
add_filter( 'tec_tickets_ticket_stock', [ $this, 'filter_ticket_stock_value' ], 10, 2 );
}

/**
Expand All @@ -124,6 +126,42 @@ public function unregister(): void {
remove_filter( 'update_post_metadata', [ $this, 'handle_ticket_meta_update' ], 10 );
remove_action( 'before_delete_post', [ $this, 'restock_ticket_on_attendee_deletion' ] );
remove_action( 'wp_trash_post', [ $this, 'restock_ticket_on_attendee_trash' ] );
remove_filter( 'tec_tickets_ticket_stock', [ $this, 'filter_ticket_stock_value' ] );
}

/**
* Filters the stock value for a ticket to match the seated ticket inventory.
*
* @since TBD
*
* @param int $stock The stock value.
* @param Ticket_Object $ticket The ticket object.
*
* @return int The filtered stock value.
*/
public function filter_ticket_stock_value( $stock, $ticket ) {
$seat_type = get_post_meta( $ticket->ID, Meta::META_KEY_SEAT_TYPE, true );
if ( ! $seat_type ) {
return $stock;
}

$cache_key = sprintf( 'seating_filter_ticket_stock_value_%d_%s', $stock, $ticket->ID );

$cache = tribe_cache();

// This cached value will be invalidated by the save of any Ticket, Attendee or Order.
$cached = $cache->get( $cache_key, Triggers::TRIGGER_SAVE_POST, null, DAY_IN_SECONDS );

if ( is_int( $cached ) ) {
return $cached;
}

$attendees = $ticket->get_provider()->get_attendees_by_id( $ticket->get_event()->ID );
$stock = $this->get_seated_ticket_inventory( $stock, $ticket, $attendees );

$cache->set( $cache_key, $stock, Triggers::TRIGGER_SAVE_POST, DAY_IN_SECONDS );

return $stock;
}

/**
Expand Down Expand Up @@ -172,21 +210,25 @@ public function set_event_stock_counts( $types, $post_id ): array {
if ( empty( $seat_type ) ) {
continue;
}

$capacity = $ticket->capacity();
$stock = $ticket->stock();
$sold_qty = $ticket->qty_sold();


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove these tabs.

if ( $stock ) {
$sold_qty = min( $capacity - $stock, $sold_qty );
}

if ( ! isset( $capacity_by_type[ $seat_type ] ) ) {
$capacity_by_type[ $seat_type ] = $capacity;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove these tabs.

if ( ! isset( $total_sold_by_type[ $seat_type ] ) ) {
$total_sold_by_type[ $seat_type ] = $sold_qty;
} else {
$total_sold_by_type[ $seat_type ] += $sold_qty;
}

++$types['tickets']['count'];
}

Expand Down Expand Up @@ -227,7 +269,7 @@ public function get_seated_ticket_inventory( int $inventory, Ticket_Object $tick
$return_false = static fn() => false;
add_filter( 'tribe_tickets_ticket_object_is_ticket_cache_enabled', $return_false );

$ticket_ids = [ $ticket->ID ];
$ticket_ids = [ (int) $ticket->ID ];

// Pull the inventory from the other tickets with the same seat type.
foreach (
Expand All @@ -245,7 +287,9 @@ public function get_seated_ticket_inventory( int $inventory, Ticket_Object $tick
$total_sold = count(
array_filter(
$event_attendees,
static fn( array $attendee ): bool => in_array( (int) $attendee['product_id'], $ticket_ids, true )
static fn( array $attendee ): bool =>
in_array( (int) $attendee['product_id'], $ticket_ids, true )
&& ! empty( get_post_meta( $attendee['ID'], Meta::META_KEY_RESERVATION_ID, true ) )
)
);
}
Expand Down
20 changes: 13 additions & 7 deletions src/Tickets/Seating/Frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,14 @@ public function get_events_ticket_capacity_for_seating( int $post_id ): int {

$seat_type = get_post_meta( $ticket->ID, Meta::META_KEY_SEAT_TYPE, true );

$stock = $ticket->stock();
if ( empty( $available[ $seat_type ] ) ) {
// The array's keys are the seating types. In order for us to calculate the stock per type and NOT per ticket.
$available[ $seat_type ] = $ticket->stock();
$available[ $seat_type ] = $stock;
continue;
}

$available[ $seat_type ] = $available[ $seat_type ] < $ticket->stock() ? $available[ $seat_type ] : $ticket->stock();
$available[ $seat_type ] = $available[ $seat_type ] < $stock ? $available[ $seat_type ] : $stock;
}

if ( empty( $available ) ) {
Expand Down Expand Up @@ -309,7 +310,7 @@ private function get_seat_selection_modal_content( int $post_id, int $timeout ):
protected function do_register(): void {
add_filter( 'tribe_template_pre_html:tickets/v2/tickets', [ $this, 'print_tickets_block' ], 10, 5 );

add_filter( 'tribe_tickets_block_ticket_html_attributes', [ $this, 'add_seat_selected_labels_per_ticket_attribute' ], 10, 3 );
add_filter( 'tribe_tickets_block_ticket_html_attributes', [ $this, 'add_seat_selected_labels_per_ticket_attribute' ], 10, 2 );

// Register the front-end JS.
Asset::add(
Expand Down Expand Up @@ -370,14 +371,19 @@ public function should_enqueue_assets() {
* Adds the seat selected labels to the ticket block.
*
* @since 5.16.0
* @since TBD Removed the $event_id parameter.
*
* @param array $attributes The attributes of the ticket block.
* @param Ticket_Object $ticket The ticket object.
* @param int $event_id The post ID.
*
* @return array The attributes of the ticket block.
*/
public function add_seat_selected_labels_per_ticket_attribute( array $attributes, Ticket_Object $ticket, int $event_id ): array {
public function add_seat_selected_labels_per_ticket_attribute( array $attributes, Ticket_Object $ticket ): array {
$event_id = $ticket->get_event_id();
if ( ! $event_id ) {
return $attributes;
}

if ( ! tec_tickets_seating_enabled( $event_id ) ) {
return $attributes;
}
Expand Down Expand Up @@ -492,10 +498,10 @@ public function build_seat_type_map( ?int $post_id = null ): array {
'tickets' => [],
];
}

/** @var Tickets_Handler $tickets_handler */
$tickets_handler = tribe( 'tickets.handler' );

$seat_type_map[ $seat_type ]['tickets'][] = [
'ticketId' => $ticket_id,
'name' => $ticket->name,
Expand Down
31 changes: 31 additions & 0 deletions src/Tickets/Seating/Orders/Attendee.php
Original file line number Diff line number Diff line change
Expand Up @@ -425,4 +425,35 @@ public function adjust_attendee_page_render_context_for_seating( array $render_c

return $render_context;
}

/**
* Check if the attendee has a seating ticket and valid reservation.
* If it's a seating ticket without reservation, the inventory should not be decreased.
*
* @since TBD
*
* @param bool $decrease_inventory Whether to decrease inventory.
* @param array<string,mixed> $attendee The attendee data.
*
* @return bool Whether to decrease inventory.
*/
public function should_decrease_inventory( $decrease_inventory, $attendee ): bool {
if ( ! $decrease_inventory ) {
return $decrease_inventory;
}

$ticket_seat_type = get_post_meta( $attendee['product_id'], Meta::META_KEY_SEAT_TYPE, true );

if ( empty( $ticket_seat_type ) ) {
return $decrease_inventory;
}

$has_reservation = get_post_meta( $attendee['ID'], Meta::META_KEY_RESERVATION_ID, true );

if ( empty( $has_reservation ) ) {
return false;
}

return $decrease_inventory;
}
}
Loading