HomePage Forums Themes Support Triply – Tour Booking WordPress Theme How to add custom field in checkout

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #24943
    hiren
    Supported

    Hello there!

    Let me know How to add a custom field in the checkout Contact Information form and Extra guest form?

    I want to add person weight (kg) in the Contact information form and Extra guest form.

    Also, let me know how to send this new field data to email notification.

    Thanks,
    Hiren.

    #24953

    Hi you,

    This customization includes adding fields to the checkout form and processing the data to save the data order after checkout. I will give you instructions on how to do this, and you will have to make these customizations yourself, if you cannot handle it yourself we will customize it for you and you will have to pay an extra fee for this:

    Step 1: Overwrite triply/template-parts/booking/checkout/information.php file in child-theme, then add your custom fields

    Step 2: Process order data after checkout:
    – add_filter babe_checkout_field_label to add field labels for custom fields
    – add_filter babe_sanitize_checkout_vars, babe_order_to_pay_ready to check the value of custom fields
    These custom data will be sent with the previously available data via email, but it must be checked for the value as in step 2.

    #24977
    hiren
    Supported

    Hello Billy,

    I am good with Step 1, But I can’t understand Step 2.

    I implemented the following link code for step 2 but it’s not worked.
    https://wordpress.org/support/topic/add-custom-field-at-checkout/

    Also, tell me how to add a field on Extra guest 2 and so on.

    Thanks,
    Hiren.

    #25017

    Hi,

    #1. In the topic you mentioned, I have fully guided the custom code that you need to add as I instructed in step 2.

    #2. Extra guest:

    Remove custom code from plugin:
    remove_filter('babe_checkout_after_contact_fields', array('BABE_html', 'extended_guest_fields' ), 10, 2);

    Then add_filter your custom code to this filter hook:

    add_filter('babe_checkout_after_contact_fields','prefix_fnc_extended_guest_fields' , 10, 2);
    function prefix_fnc_extended_guest_fields($output, $args){
    // Your code
    return $output;
    }

    As I said, these are just guidelines and solutions for you to follow if you are someone who can understand and handle the code.
    I can’t give you more detailed instructions, it takes quite a while and this is not the free support we can help you with.
    We hope you understand and sympathize!

    • This reply was modified 1 month, 1 week ago by Billy Nguyen.
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.