verbb / events

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

No purchased tickets are generated when the order is updated. #139

Closed mihob closed 1 month ago

mihob commented 10 months ago

Describe the bug

If ticket line items are subsequently added to a completed order, no purchased tickets are generated.

Is that intended?

Steps to reproduce

  1. Create a new order and complete it.
  2. Edit the order and add more ticket items

Craft CMS version

Craft Pro 4.7.0

Plugin version

2.0.3

Multi-site?

Yes

Additional context

No response

engram-design commented 10 months ago

That's an interesting one. We perform the creation of purchased tickets in the afterOrderComplete method for the purchasable, but the order has already been completed here.

Similarly, this is how Commerce handles purchasing a variant of a product by decrementing its stock levels. I've not actually tested, but if you add a line item of a regular product/variant to an order and save, does that decrement stock levels for that product/variant?

mihob commented 10 months ago

I'm sorry, I don't know that. We only sell tickets.

But I think that if you modify an order afterwards, for example at the customer's request, and add further ticket line items, purchased tickets should also be generated accordingly.

Otherwise there is no way to create the purchased tickets manually.

engram-design commented 10 months ago

The reason that this sort of thing hasn't been implemented, is that it feel very wrong (in my opinion) to change purchased tickets when you modify an order after the fact. There's a lot of complexities that start rearing their head.

One example might be you've purchased 5 tickets, so there's either 5 tickets in your order as line items, or a single ticket with a quantity of 5. You distribute these tickets to 5 different people.

You then decide you want to change the quantity to 4 as someone wants to cancel their ticket. You might go into the order and adjust the quantity from 5 to 4. But our plugin doesn't know which ticket should be invalidated and refunded. We could end up cancelling the wrong purchased ticket, which just leads to confusion.

Additionally, we would have to handle payment again if you wanted to make that 6 tickets.

Finally, for capacity-driven events where there's not much room for extra tickets, all it takes is an accident from the control panel to book out all tickets. There's a lot more safety in completing checkout again.

So I think what we're really after is having a purchased ticket manager for an order. This isn't something we can build into the Commerce order-edit component written in Vue, as that's very limited for what we need to do. But that's what I see needs to happen here, we're you've got full control over the contents of an order, what to do with any tickets purchased or removed, whether they should be added back to the event capacity or not (there are cases where this is valid) and lots more.

We'll have to give it some thought on how best to implement this that's flexible, but also not too separated from editing an order.

engram-design commented 1 month ago

Fixed in 3.0.0-beta.3.