Support

Home Forums Event Espresso Premium add discount through registration process

add discount through registration process

Posted: January 31, 2020 at 6:44 am

Viewing 6 reply threads


adasch

January 31, 2020 at 6:44 am

Hi there,
right now I have a radio button question related to the payment options.
How can I manage it, that with option A the registree get’s a discount (eg 5%) and the new total price is correctly showed on the next page. Is that possible?


adasch

February 4, 2020 at 4:32 am

Hi there,
is there no solution for this? I really need that kind of dynamic / relational form.

Thanks for any tip!!


Tony

  • Support Staff

February 6, 2020 at 5:27 am

Hi there,

Where are you adding the radio button? On the registration form?

Whilst we don’t currently have an option for this, we have a snippet that adds a surcharge based on selecting a value on the registration form:

https://github.com/eventespresso/ee-code-snippet-library/blob/master/checkout/bc_ee_apply_transaction_surcharge.php

If you are comfortable with PHP you can adjust that to check for your radio button and apply a discount rather than a surcharge.


adasch

February 6, 2020 at 7:11 am

Hi Tony,
thank you – this seems to be exactly what I am looking for. (as a matter of fact I do want to add a surcharge instead of a disount – I just did not know the english term for that 🙂

To test the script, here is what I did
– I copied the script to my functions.php (child theme folder).
– I added a new question in my reg form “Ticket Printing”, set it to required
– It works so far – I can see the dropdown durch registration process

BUT no matter if I choose “you print tickets at home” or “we print and ship tickets”, the calculated price on the next page is alwas the same. I expected that it is a bit higher with “we print …” selected.

I dont understand the snippet exactly. I suppose with “we print” selected, the total price should be plus 2.50 – is that right? It doesn’t work here. I also cant’t figure out where the calculation happens, as I’d like not to add a fixed amount of money but like +5% (percentage) of the price.

thanks for help!!


Tony

  • Support Staff

February 6, 2020 at 7:52 am

Did you set the question id to match the ID of your question?

https://github.com/eventespresso/ee-code-snippet-library/blob/master/checkout/bc_ee_apply_transaction_surcharge.php#L36

I also cant’t figure out where the calculation happens, as I’d like not to add a fixed amount of money but like +5% (percentage) of the price.

The snippet adds a fixed amount that would be visible on the payment options step, once you get the snippet working to add a surcharge as intended I’ll discuss changing it for a percentage.


adasch

February 7, 2020 at 10:18 am

Oh – I overlooked that. Thanks, now it’s working.

Now, how can I change the surcharge for a percentage?
thanks so much for your help! I really appreciat it!


Tony

  • Support Staff

February 11, 2020 at 4:30 am

You’d would set up the line items to be something like:

'LIN_name'       => $name,
'LIN_desc'       => $description,
'LIN_unit_price' => 0,
'LIN_percent'    => (float) $surcharge_details[ 'unit_price' ],
'LIN_quantity'   => 1,
'LIN_is_taxable' => $surcharge_details[ 'taxable' ],
'LIN_total'      => (float) ($surcharge_details[ 'unit_price' ] * ($grand_total->total() / 100)),
'LIN_type'       => EEM_Line_Item::type_line_item,
Viewing 6 reply threads

The support post ‘add discount through registration process’ 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