Support

Home Forums Event Espresso Premium Price Locked on old price

Price Locked on old price

Posted: February 14, 2022 at 5:23 pm

Viewing 4 reply threads


pathwise

February 14, 2022 at 5:23 pm

Hi there!
I’m having an issue with a past price still showing because it is locked from having a previous user buy a ticket. We have since changed the price, and moved the user out of that priced ticket in order to unlock and delete this.
We need to remove this price, as we use the prices in some custom code to show them in a sidebar widget for Upcoming Courses.
Is there a way to unlock this previous price and remove it entirely so that we can avoid this showing up anywhere?
Price is locked on a previous price
Thank you in advance for any help you can provide!


Tony

  • Support Staff

February 15, 2022 at 8:15 am

Hi there,

You can’t delete a ticket if it has registrations assigned to it as you’ll break the relationship, however what you can do is delete the registrations assigned to it and then remove the archived ticket.

Your archived ticket shows 1 registration assigned to it, what is that registration?

We need to remove this price, as we use the prices in some custom code to show them in a sidebar widget for Upcoming Courses.

Can you not just adjust the code to not pull in archived tickets?


pathwise

February 15, 2022 at 12:25 pm

Hi Tony!

So, we had removed that registration and moved it to the new price. Is there another way we can delete this registration if we have moved it? Is it holding itself in the system because it was a registration to that price at some point?

I can speak to our developer about adjusting the code as well.


pathwise

February 15, 2022 at 1:15 pm

Hi Tony,

Here is how we are getting the ticket price, how do you recommend we get the price to avoid this in the future.

        if ( $post->EE_Event instanceof EE_Event ) {
            $ticket_array = $post->EE_Event->first_datetime()->tickets();
            $first_ticket = array_shift($ticket_array);
            $ticket_price =  $first_ticket->pretty_price();
        }
        else {
            $ticket_price = "";
        }


Tony

  • Support Staff

February 15, 2022 at 3:07 pm

So, we had removed that registration and moved it to the new price.

Moved it with the Attendee mover add-on?

Is there another way we can delete this registration if we have moved it?

You’re removing data here so we always recommend creating a database backup first just in case you need it.

Depends where it’s from, you can usually delete them if you find them in Event Espresso -> Registrations.

Then hover over the registration and click Trash link that appears.

Then go to the ‘Trash’ filter: https://monosnap.com/file/K98iZ9dET3aTJh9H4iAYsgvLeXuz6w

Hover over the registration and click Delete to perm delete.

That should remove it.

Is it holding itself in the system because it was a registration to that price at some point?

The registration won’t really ‘hold a space’, it’s showing as a registration because it is liked that ticket.

When a registration is created it stores the ID of the EE_Contact and the ID of Ticket it is linked to, it does NOT store the price of the registration at the time. That means that if you were to change the price on a specific ticket it would change the price of ANY registration links to that ticket, not just new registrations.

So, when a Ticket has registrations linked to it, Event Espresso will not let you change the price of the ticket, when it detects a price change it archives the original ticket and created a duplicate with the new price. Meaning registrations linked to the ‘old’ ticket still show the original price, new registrations get the new price and so on.

You can’t then just delete the archived ticket as you’ll break the relationship to the old registrations and get fatal errors when it tries to pull the ticket it is related to but if you remove the regs first, then you can delete that ticket.

Here is how we are getting the ticket price, how do you recommend we get the price to avoid this in the future.

You could do with battle hardening your code there, check you have an instance of the objects you’re expecting before you use them.

As for the change needed, your using our models, so you can pass the query params to the method call, so this:

$ticket_array = $post->EE_Event->first_datetime()->tickets();

With an additional where condition so it doesn’t pull deleted/archive tickets, becomes:

$ticket_array = $post->EE_Event->first_datetime()->tickets(array(array('TKT_deleted' => 0)));

You could also add 'limit' => 1 to the query param to just return a single ticket:

$ticket_array = $post->EE_Event->first_datetime()->tickets(array(array('TKT_deleted' => 0), 'limit' => 1));

Viewing 4 reply threads

The support post ‘Price Locked on old price’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso