Conversation
supportHi, I need to add a field to checkout contact informations. I tried to add the code to the functions.php file according to the documentation ( https://ba-booking.com/ba-book-everything/documentation/customization/add-custom-fields-to-the-checkout/ ). My code: add_filter('babe_checkout_args', 'customtheme_babe_checkout_args', 10, 2); /** * Add checkout text field */ function customtheme_babe_checkout_args( $args_meta, $args ) { $args_meta['pickup'] = $args['meta']['pickup'] ?? ''; return $args_meta; } //////// add_filter('babe_checkout_field_label', 'customtheme_babe_checkout_field_label', 10, 2); /** * Add checkout field title */ function customtheme_babe_checkout_field_label( $field_title, $field_name ) { if ($field_name === 'pickup'){ $field_title = __('Pick up location', 'textdomain'); } return $field_title; } //////// add_filter('babe_checkout_field_required', 'customtheme_babe_checkout_field_required', 10, 2); /** * Required tag for checkout field. Use it only if you need to make field required */ function customtheme_babe_checkout_field_required($required_tag, $field_name){ if ($field_name === 'new_field'){ $required_tag = 'required="required"'; } return $required_tag; } /////////////////// add_filter('babe_sanitize_checkout_vars', 'customtheme_sanitize_checkout_vars', 10, 2); /** * Add fields to sanitize checkout vars method */ function customtheme_sanitize_checkout_vars( $output, $arr ) { $output['pickup'] = isset($arr['pickup']) ? sanitize_text_field($arr['pickup']) : ''; return $output; } But – nothing. Can you please advise me? The page I need help with: [ log in to see the link]
No comments were stored for this source.