Support

Home Forums Event Espresso Premium Example for add to cart redirect filter

Example for add to cart redirect filter

Posted: April 2, 2017 at 2:28 am


hodyhong

April 2, 2017 at 2:28 am

Hi there,

I have been trying to use the this filter (FHEE__EED_Multi_Event_Registration__filter_ticket_selector_redirect_url__redirect_to_cart) to make the page redirect to the event cart page after adding an event to the event cart. Couldn’t get it working.

This is what I have got:

function ee_change_redirect(){
	return true;
}
add_filter( 'FHEE__EED_Multi_Event_Registration__filter_ticket_selector_redirect_url__redirect_to_cart', "ee_change_redirect" ,10,2 );

Can you please throw in an example?


Lorenzo Orlando Caum

  • Support Staff

April 2, 2017 at 5:33 pm

Hi Hody,

There is an example here:

https://eventespresso.com/wiki/ee4-multiple-event-registration-add-on/#customizations

Scroll down a bit further once you click the link above.

It can be added to a site specific plugin: https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/


Lorenzo


hodyhong

April 2, 2017 at 6:13 pm

Hey Lorenzo,
The example you have shown covers different thing. I have actually provide you what I have done in my code, I thought that particular filter (FHEE__EED_Multi_Event_Registration__filter_ticket_selector_redirect_url__redirect_to_cart ) returns a True/False statement, but it just doesn’t seem to be working.


Tony

  • Support Staff

April 3, 2017 at 7:04 am

Hi there,

Can I ask why you are redirecting the user to the cart once they add a single ticket to the cart? If you do that you might as well not use the Multi Event Registration add-on and just had the users register from the ticket selector directly.

The filter you are using does not work when the MER model is active (this – http://take.ms/4nUXW) as it disables the standard ticket selector submit so in order for this to work how you are requesting you’ll also need to dequeue the ‘espresso_multi_event_registration’ script, however again this defeats the purpose of the Multi Event Registration add-on unless I’m missing something?

The code you posted above can be cleaned to to be:

add_filter( 'FHEE__EED_Multi_Event_Registration__filter_ticket_selector_redirect_url__redirect_to_cart', '__return_true', 10);

No values are passed to the filer to the 2 at the end is un-needed.


hodyhong

April 3, 2017 at 12:22 pm

Hi Tony, thanks for your reply. We do have multiple events, so reveiwing the cart after adding the ticket to cart make senses.
If you have to disable the MER Modal popup, why do you have include that filter in MER anyway? It is not gonna work? That doesn’t make sense.
The modal popup was a bit confusing to the customers because there are quite a few options for them to choose from (ie, to register, or to the cart).
What I have done is to modify the template to only include the go to cart link in the modal popup.


Tony

  • Support Staff

April 3, 2017 at 12:55 pm

We may have some crossed wires here.

The filter you are using forces the ticket selector to direct the user to the cart when they submit a ticket selection. So at that point you don’t need the modal as your already forcing the user to the cart, but now you state that removing the modal doesn’t make sense? That doesn’t make sense 🙂

If we didn’t have that filter you couldn’t change it at all.

But as the above doesn’t make sense let’s start from the beginning.

What are you trying to do with the filter?

What is your expected behavior when using the filter?


hodyhong

April 4, 2017 at 1:54 am

Hi Tony,I think you have misunderstood my message. I couldn’t get the filter working, therefore I have modify the template for the modal popup to not to include the the proceed to registration link.
I didn’t end up using the filter because according to you, I will have to dequeue the MER script.
Is this clearer?

H


Tony

  • Support Staff

April 4, 2017 at 2:46 am

Nope, I understand.

I know you couldn’t get the filter to work, but you also posted this:

If you have to disable the MER Modal popup, why do you have include that filter in MER anyway? It is not gonna work? That doesn’t make sense.

If you DID have that filter working the modal wouldn’t be used as the point of the filter is direct the user straight to the cart when the user submits a ticket on any of the ticket selectors, so the modal is no longer needed as your skipping that step when using the filter.

The user would go from here – http://take.ms/9lZpC

Directly to here – http://take.ms/nggTx

Again I know you didn’t get it working, but that’s what the filter does, so… can you answer my questions please:

What are you trying to do with the filter?

What is your expected behavior when using the filter?


hodyhong

April 4, 2017 at 2:53 am

I actually do not need the modal, and want to get the customer go directly to the shopping cart. But from your previous message, you have already stated that by removing the modal, defeats the purpose of the MER. That’s why I commented previously saying why include such filter in MER, if it will undermine MER? Thats what confuses me.

I didn’t know you have to dequeue the modal script in order to make the filter to work. That’s why I have modified the modal template.

What I wanted was a simple straightforward user experience with less choices to choose from. From add to event cart, straight to the event cart, if they want to proceed to registration and pay for it, go straight there, no fuss.


Tony

  • Support Staff

April 4, 2017 at 3:47 am

Ok, so it sounds like you don’t need MER at all? You may as well disable the Multi Event Registration Add-on and use the ‘standard’ ticket submissions.

But from your previous message, you have already stated that by removing the modal, defeats the purpose of the MER.

Disabling the modal is not what defeats the purpose of MER, directing the user straight to the cart does.

The purpose of MER is to allow you to select tickets from multiple events and add them to a ‘cart’, then when you’ve added all the tickets they require they proceed to the checkout and complete the registrations.

By directing the user straight to the cart when they select a ticket (using the filter) you either intend for the user to purchase a single ticket each time (removing the need for MER) or make it more complicated for the user as if they want to add another ticket to the cart they again need to return to the event list and add more tickets to the cart (each time being re-directed to the cart and having to navigate back).

So what your suggesting does not make this straightforward if selecting tickets from multiple events, it’s the opposite.

I didn’t know you have to dequeue the modal script in order to make the filter to work. That’s why I have modified the modal template.

So again, what was you expecting the filter to do?


hodyhong

April 4, 2017 at 4:31 am

Hi Tony,

Firstly, I am using the MER, because there are multiple events happening at the same time. So hopefully this is clear.

Secondly, in the documentation for MER, the filter is available for directing customer right after people adding the event to the cart. That’s exactly what I was after. I posted this so that I can get help on using filter without the knowledge that I had to first dequeue the modal script. And you were the one naming by using the filter, defeats the purpose of the MER. That’s when I get really confuse, why including such filter in the MER documentation, if it is not meant to be. Am I clear of my position? I am simply pointing it out that, by including the filter in the MER documentation, you expect people to use it.

Thirdly, the customers we are serving expect to review their event cart after they have added an event to it. This caters specifically to the requirement. And we do have multiple events, and people will purchase multiple events and want to pay for them in one transaction. This is why I have selected MER for it. It has presented to us that, out of the box, with EE employing a modal box with several options was not straightforward to our customers. That’s reason I was looking for an alternative: presents less options.

H


Tony

  • Support Staff

April 4, 2017 at 5:06 am

Secondly, in the documentation for MER, the filter is available for directing customer right after people adding the event to the cart. That’s exactly what I was after.

You can do that using the filter and dequeuing the modal script on any other page other than the registration-checkout page.

I posted this so that I can get help on using filter without the knowledge that I had to first dequeue the modal script. And you were the one naming by using the filter, defeats the purpose of the MER. That’s when I get really confuse, why including such filter in the MER documentation, if it is not meant to be. Am I clear of my position?

IMO directing the user directly to the cart on ticket submission makes it more complicated than using the model, looks like I should have phrased that differently above. MER will continue to work if you dequeue the script and use the filter but directing the user to the cart on each option added to the cart is a poor user experience (which is why we have the modal in the first place)

I am simply pointing it out that, by including the filter in the MER documentation, you expect people to use it.

Its not an expectation but it provides the option to do something we don’t do by default, without the filter we limit what developers can do as they can only do things the way we have them already, so we have multiple filters through EE to allow for change. Developers are more than welcome to use them to create new features.

The current filter works and does what it is expected to do.

Thirdly, the customers we are serving expect to review their event cart after they have added an event to it. This caters specifically to the requirement.

You can do that using the filter and dequeuing the modal script on any other page other than the registration-checkout page.

And we do have multiple events, and people will purchase multiple events and want to pay for them in one transaction. This is why I have selected MER for it.

OK so then yes you need MER.

It has presented to us that, out of the box, with EE employing a modal box with several options was not straightforward to our customers. That’s reason I was looking for an alternative: presents less options.

If you’d like to share some feedback on how we can improve the modal I’ll happily pass that along to the developers, however the modal currently has 3 options…

Return to the event list (add further tickets)
Proceed with registration (continue to checkout)
View Event Cart (view cart)

http://take.ms/SRUBB

It’s actually less options than the user has within the cart itself by default and allows you to add multiple events to the cart without re-directing the user to the cart each time.

You can not have the modal and direct the user to the cart on each ticket selection as the whole point of the modal is to prevent that so the user doesn’t have to navigate to multiple pages each time (which directly the user straight to the cart will cause)


hodyhong

April 5, 2017 at 1:07 am

Hi Tony,
I previously did not know that filter works at other places as well. It’s a bit shooting in the dark for me, as I am only using it at the single event page, while customers are selecting a ticket and add that to cart.
I do appreciate you are patient with me. I was a bit confused by all documentation around.

On the side note, while I was receiving a lot of attentions from you guys on this post, my other post have not received any feedback. Could you please have a look at it? It was this one: https://eventespresso.com/topic/event-cart-to-include-tax-in-sub-total-and-unit-price/

Thanks a lot.

H


Tony

  • Support Staff

April 6, 2017 at 2:48 am

Hi H,

I’ve replied in you’re other thread.

The support post ‘Example for add to cart redirect filter’ 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