Support

Home Forums Event Espresso Premium EE code snippet

EE code snippet

Posted: March 14, 2020 at 8:25 am


ericabanes

March 14, 2020 at 8:25 am

Hi guys,

I’ve been using this snippet and to good effect, thanks for providing: https://github.com/eventespresso/ee-code-snippet-library/blob/master/checkout/bc_ee_apply_transaction_surcharge.php

However, is there a way to assign a quantity to this? So in your code, say cap ‘shipping fee’ so when one registrant has chosen that option, it is no longer available to other registrants?

In my case, I’m using this to build add-ons but said add-ons have limited availability and large $/£ values so don’t want to get sucked into issuing large refunds if registrants are adding-on something we no longer have available. Do this make sense?

Thanks so much in advnace


Josh

  • Support Staff

March 19, 2020 at 3:40 pm

Hi,

This does make sense, however the code from the snippet does not include a way to assign a quantity, and actually it would require more than just assigning a quantity to make a question option no longer available. Something would also need to retrieve the number of times the chosen option has previously been selected. Then some additional logic to remove an option if no longer available.

So this could be possible but would require some significant development that would be in addition to the snippet you’re already using. One approach could be use the FHEE__EE_Question__generate_form_input__return filter hook to alter what’s available as an option (based on information from previous selections from other registrations already in the database).

This type of project will require the experience of a PHP developer that’s familiar with the WordPress plugin API and has a good grasp of object-oriented programming. Not every team has this, and when that’s the case we recommend contacting codeable.io, they have developers there that could do a project like this for a reasonable fee.

The support post ‘EE code snippet’ 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