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

Overbooking is possible #129

Open
mihob opened this issue Dec 5, 2023 · 8 comments
Open

Overbooking is possible #129

mihob opened this issue Dec 5, 2023 · 8 comments

Comments

@mihob
Copy link

mihob commented Dec 5, 2023

Describe the bug

It is possible to buy any number of tickets as long as an event is not fully booked.

For example, if an event has 10 seats, it is possible to buy 100 tickets.

It should not be possible to add more tickets to the shopping basket than are available.

The same problem exists on a ticket basis

Steps to reproduce

  1. For example, set the capacity limit of an event or a ticket to 10
  2. Add 20 tickets to the shopping basket
  3. Finalise the purchase

Craft CMS version

Craft Pro 4.5.11.1

Plugin version

2.0.2

Multi-site?

Yes

Additional context

No response

@engram-design
Copy link
Member

Not seeing that, sorry. I'm getting the message "You reached the maximum ticket quantity for Test Event" whenever I try and add more tickets to my cart than are available for the event. This should be controlled through here

@mihob
Copy link
Author

mihob commented Dec 5, 2023

I think the problem is that we don't add a ticket with a quantity of 10, but the ticket 10 times as a single item (each with a unique hash hidden in the option array).

We do this because we have to query the first name and surname for each individual ticket and therefore need individual line items.

You don't seem to be looking at the total quantity that is added to the shopping basket.

@engram-design
Copy link
Member

Gotcha. Yes, when singular line items are added this will be an issue. Normally, even if you add a ticket one at a time, they are combined into a single line item with multiple quantity set.

Fixed for the next release. To get this early, run composer require verbb/events:"dev-craft-4 as 2.0.2".

I should also note that the plugin doesn't provide a 100% bullet-proof overbooking protection mechanism. For one, there's no reserve system, so technically if multiple people checkout at the same time, there's the potential for tickets to be purchased at the same time, over the limit. There's also no reservation on "stock" when adding to the cart, so one user might've added all remaining tickets to the cart (but not purchased) and another user does the same, and whoever checks out first gets the tickets.

@engram-design
Copy link
Member

Should be fixed in 2.0.3

@mihob
Copy link
Author

mihob commented Dec 27, 2024

@engram-design If I see it correctly, the problem is back with version 3.0

@engram-design
Copy link
Member

@mihob I can't add items to my cart if it's over the threshold of capacity in 3.0.4.

For example, I set my ticket type capacity to 10, and try and add 11 tickets to my cart, I get an error message:

Unable to update cart. lineItems.0.qty: There are only 10 “My Event - 28/12/2024 1:00 pm — 2:00 pm” items left in stock.

If I set the Event Capacity to 5, which overrides ticket type capacity, then I get the same error message.

If I add one item at a time, as I commented, I still reach that error message.

@mihob
Copy link
Author

mihob commented Dec 28, 2024

@engram-design

Hmm

I get the error message when I try to add them all at once.

But if I add the tickets individually, I can add as many as I want.

Can you tell me where this is checked in the code? This seems to have changed in version 3

@engram-design
Copy link
Member

Strange! I did ensure to test both methods just in case. Can you let me know your updates event setup for Events 3, just so we're on the same page?

It should be all routed through $ticket->getIsAvailable()

@engram-design engram-design reopened this Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants