Custom Billing Fields for Particular Events

Home Forums Ticket Products Event Tickets Plus Custom Billing Fields for Particular Events

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #76536
    Marcus
    Participant

    I’ve had no problem hooking up the Woocommerce Tickets module and inserting my own constant custom checkout fields via this documentation:
    http://docs.woothemes.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/

    However, I have a few custom checkout fields I’d like to conditionally add based on the type of event. For example, I’d like to include a “Dietary Restrictions” field for events involving food.

    I’ve concocted one way to maybe do this, but I wanted to see if maybe I was taking the long way around:
    Admin Step 1) Enter an event and a corresponding ticket.
    Admin Step 2) Find that ticket under products and categorize it as “Includes Food”.
    Developer Step 1) In functions.php, add a field “Dietary Restrictions” with the class “food”.
    Developer Step 2) In the css, set class “food” to display:none.
    Developer Step 3) On the checkout form (woocommerce/form-billing), access the Woocommerce cart object to retrieve the product id(s).
    Developer Step 4) Loop through the product ids, retrieving their Product Categories to see if any are classified as “Includes Food”.
    Developer Step 5) If so, set class “food” to display:block.

    It seems a little circuitous for both the admin and the developer, and it also modifies a core Woocommerce file, so I’m hoping someone has a better suggestion. Thanks!

    #76727
    Kelly
    Participant

    Hi, Marcus. This is an excellent question.

    Unfortunately, I don’t know of a simpler way to do it at present. I’m actually impressed that you’ve put something together that will do the job so nicely!

    Sorry I can’t be of more help! 🙂

Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘Custom Billing Fields for Particular Events’ is closed to new replies.