verbb / events

Craft CMS Plugin for events management and ticketing.
Other
22 stars 13 forks source link

Deleting a purchased ticket doesn't increment the available quantity #109

Closed cholawo closed 1 month ago

cholawo commented 2 years ago

Describe the bug

When a purchased ticket is deleted, the available quantity doesn't go up by 1.

Steps to reproduce

  1. Make an event with a Ticket Type that has a quantity of 1
  2. Purchase a ticket
  3. Delete the purchased ticket
  4. See that the event is now sold out Screenshot 2022-09-14 at 12 44 15

Craft CMS version

3.7.48

Plugin version

1.4.22

Multi-site?

No

Additional context

No response

engram-design commented 2 years ago

I've commented about this here, but it's mostly due to issues with soft-deletion. If you delete a purchased ticket, it'll soft delete the ticket, adding back capacity to the event. But restoring it will reverse that. What if the event is sold out already?

There's also the assumption that if you delete a purchased ticket you want ticket capacity to be affected, and you're assuming the ticket has been cancelled. There has been an occasion where a client of ours has wanted to delete a ticket (mistakenly oversold an event) and they would not want this behaviour.

So it's a bit tricky - which is also why I imagine Commerce doesn't do the same thing with product stock levels when an order is deleted.

cholawo commented 2 years ago

Thanks for the prompt reply. I did read your comment about Commerce order soft-delete before I created this issue and I can appreciate that conundrum with regards to orders, however since I could see now way to restore a deleted ticket, I thought it should have restored capacity (I didn't know they were soft-deleted).

I need to document the correct procedure for what an admin should do when a customer wants to cancel an order. I think they would need to:

  1. Find all the tickets for that order (I think the only way is to copy the order number and then search the purchased tickets list)
  2. Make a note of which events and how many of each ticket type there are
  3. Delete those tickets (so that they cannot be scanned on the door)
  4. Edit the events to add back capacity for their ticket types
  5. Refund the order

This is quite an inconvenient process for what I would think is the most common use case, but I do take on board what you're saying about intention. I think I'm going to have to add some well labeled buttons to the interface to automate some of these steps away for a smoother cancellation process.

engram-design commented 2 years ago

I'd like to improve this for sure, and likely buck the trend of what Commerce is doing. I just need to some up with a better way of handling that! I'll keep this open in the meantime.

cholawo commented 2 years ago

Thanks! There might be some easy wins to improve the process before automation is in place. I think the most important would be helping admins get from viewing the commerce order to viewing a list of its tickets. If I could get a link on the commerce order page that points to the purchased tickets list that would help. Something like /{cpUrl}/events/purchased-tickets?order=b1253d2. It looks like the purchased ticket page doesn't look at url parameters at present though.

cholawo commented 2 years ago

I have found that I can link to purchased tickets from a commerce order by adding a template to the order fields. This means admins can navigate directly from order to its tickets and delete them where necessary. I'm just documenting this in case it helps anyone else.

image
{% set tickets = craft.events.purchasedTickets().orderId(element.id).all() %}
{% if tickets|length %}
<h1>Purchased Tickets</h1>
<ul>
    {% for ticket in tickets %}
        <li>
            <a href="/admin/events/purchased-tickets/{{ ticket.id }}" target="_blank">
                {{ ticket.event ? ticket.event.title : '' }} - {{ ticket.ticketType }}
            </a>
        </li>
    {% endfor %}
</ul>
{% endif %}
image
engram-design commented 1 month ago

Updated in 3.0.0-beta.3.