HomePage › Forums › Themes Support › Triply – Tour Booking WordPress Theme › How to add custom field in checkout
Tagged: checkout, custom field
- This topic has 3 replies, 2 voices, and was last updated 1 year, 10 months ago by Billy Nguyen.
-
AuthorPosts
-
July 1, 2022 at 11:26 pm #24943hirenSupport Expired
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.July 2, 2022 at 9:23 am #24953Hi 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.July 2, 2022 at 7:45 pm #24977hirenSupport ExpiredHello 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.July 4, 2022 at 2:53 pm #25017Hi,
#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 year, 10 months ago by Billy Nguyen.
-
AuthorPosts
You must be logged in to reply to this topic.