Adding a price changing select

This topic contains 1 reply, has 2 voices, and was last updated by  Stephen Harris 8 years, 5 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #24666

    Hi there,

    Is it possible to add fields that increase the price of the total? For example, i want to add a select dropdown where depending on the option selected, adds a specific value to the total price.

    Thanks

    Will Lawrence
    #24672

    Hi Will,

    It is possible. The discount plug-in does something similar (adds a field to the booking form, which when matches a valid discount code, discounts an amount from the total).

    The VAT extension doesn’t use a booking form field, but does demonstrate how you can alter the booking price: https://github.com/stephenharris/Event-Organiser-VAT

    In short, you’d need to write some PHP code which filters the booking price (as demonstrated in the VAT Plug-in or discount codes plug-in) and alter its value based on the information store with the booking form (i.e. eo_get_booking_meta( $booking_id, 'meta_{form-field-id}'); where {form-field-id} is the ID of your booking form.

    You will probably want to (but it is not essential) add a JavaScript event to listen for the change in selected valued for your select field and update the total on the booking form itself (again, the VAT extension and discount codes demonstrate how to do this). This is purely aesthetic, it’s the PHP code that determines the amount the user is charged.

    Stephen Harris
Viewing 2 posts - 1 through 2 (of 2 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.