I would appreciate any assistance with the following...
On my WooCommerce checkout page, I need to allow my customers to select their multiple preferred distributors and then have the new order emails sent out to myself and only the dealers they select.
I can't for the life of me figure out how to set it up using multi-checkboxes, which would allow them to select more than one (i.e. they select Distributor 1 and 3, and only the three of us receive the new order email).
I was able to figure it out using a dropdown menu (thanks to reading through a variety of posts within this community). Any help would be greatly appreciated! :)
Current code I was able to piece together (just a tiny bit proud of myself because it actually works):
// // Add custom checkout field
add_action( 'woocommerce_after_order_notes', 'sj_custom_checkout_field' );
function sj_custom_checkout_field( $checkout ) {
echo '<div id="sj_custom_checkout_field"><h2>' . __('Distributor') . '</h2>';
woocommerce_form_field( 'my_field_name', array(
'type' => 'select',
'class' => array('wps-drop'),
'required' => true, // Missing
'options' => array(
'' => __( 'Select Your Preferred Distributor', 'wps' ),
'Distributor 1' => __( 'Distributor 1', 'wps' ),
'Distributor 2' => __( 'Distributor 2', 'wps' ),
'Distributor 3' => __( 'Distributor 3', 'wps' ),
'Distributor 4' => __( 'Distributor 4', 'wps' ),
'Distributor 5' => __( 'Distributor 5', 'wps' )
)
), $checkout->get_value( 'my_field_name' ) );
echo '</div>';
}
// Process the checkout
add_action('woocommerce_checkout_process', 'sj_custom_checkout_field_process');
function sj_custom_checkout_field_process() {
// Check if set, if its not set add an error.
if ( empty( $_POST['my_field_name'] ) )
wc_add_notice( __( 'Please select your preferred distributor.' ), 'error' );
}
// Save the custom checkout field in the order meta
add_action( 'woocommerce_checkout_update_order_meta', 'sj_custom_field_checkout_update_order_meta', 10, 1 );
function sj_custom_field_checkout_update_order_meta( $order_id ) {
if ( ! empty( $_POST['my_field_name'] ) )
update_post_meta( $order_id, 'my_field_name', $_POST['my_field_name'] );
}
add_filter( 'woocommerce_email_recipient_new_order', 'new_order_conditional_email_recipient', 10, 2 );
function new_order_conditional_email_recipient( $recipient, $order ) {
if( is_admin() ) return $recipient;
// Get the order ID (Woocommerce retro compatibility)
$order_id = method_exists( $order, 'get_id' ) ? $order->get_id() : $order->id;
// Get the custom field value (with the right $order_id)
$my_field_name = get_post_meta( $order_id, 'my_field_name', true );
if ($my_field_name == "Distributor 1")
$recipient .= ',1#email.com';
elseif ($my_field_name == "Distributor 2")
$recipient .= ',2#email.com';
elseif ($my_field_name == "Distributor 3")
$recipient .= ',3#email.com';
elseif ($my_field_name == "Distributor 4")
$recipient .= ',4#email.com';
elseif ($my_field_name == "Distributor 5")
$recipient .= ',5#email.com';
return $recipient;
}
Alternatively, select and radio type on has same args, you can change your select to radio. Use css to make radio looks like a checkboxes if you really need the style to look like checkbox.
woocommerce_form_field( 'my_field_name', array(
'type' => 'radio',
'class' => array('wps-drop'),
'required' => true, // Missing
'options' => array(
'' => __( 'Select Your Preferred Distributor', 'wps' ),
'Distributor 1' => __( 'Distributor 1', 'wps' ),
'Distributor 2' => __( 'Distributor 2', 'wps' ),
'Distributor 3' => __( 'Distributor 3', 'wps' ),
'Distributor 4' => __( 'Distributor 4', 'wps' ),
'Distributor 5' => __( 'Distributor 5', 'wps' )
)
), $checkout->get_value( 'my_field_name' ) );
Related
I face a problem regarding woocommerce_wp_select . I am adding new fields to the single product page. First, I add the options by the following codes:
$title_110 = array(
'id' => 'custom_text_field_title_110',
'label' => __( 'Awards', 'rasa_store' ),
'desc_tip' => true,
'description' => __( 'Select an option.', 'ctwc' ),
'options' => array(
'' => __( 'Select Option', 'woocommerce' ),
'0' => __('This product does not win any awards', 'woocommerce' ),
'1' => __('This product win on award.', 'woocommerce' ),
'2' => __('This product win 2 award.', 'woocommerce' ),
'3' => __('This product win 3 award.', 'woocommerce' ),
'4' => __('This product very famous.', 'woocommerce' )
),
);
woocommerce_wp_select( $title_110 );
Than I save it.
$attribute_110 = wc_get_product( $post_id );
$title_top_110 = isset( $_POST['custom_text_field_title_110'] ) ? $_POST['custom_text_field_title_110'] : '';
$attribute_110->update_meta_data( 'custom_text_field_title_110', sanitize_text_field( $title_top_110 ) );
$attribute_110->save();
But in front page of single product page, while I use :
$attribute_11 = wc_get_product ( $post->ID );
$title_top_110 = $attribute_11->get_meta( 'custom_text_field_title_110' );
if( $title_top_110 ) {
printf(
'<div class="row">
<div class="col-md-4">
<img class="img-fluid box-10-2" src="%s/img/award-icon.png">
</div>
<div class="col-md-8 box-10">
<p class="card-text box-10-1">%s</p>
</div>
</div>
',
esc_html( get_bloginfo('template_directory') ),
esc_html( $title_top_110 )
);
}
Instead of printing This product does not win any awards I see 0.
I am looking for finding a way to fix it. I test the following methods, and they do not work:
1. Replaced update_post_meta() by get_post_meta()
2. Replaced esc_html to esc_sql
There are some different ways:
You need an additional custom function for your dropdown options this way:
function custom_field_options_title_110() {
return array(
'' => __( 'Select Option', 'woocommerce' ),
'0' => __('This product does not win any awards', 'woocommerce' ),
'1' => __('This product win on award.', 'woocommerce' ),
'2' => __('This product win 2 award.', 'woocommerce' ),
'3' => __('This product win 3 award.', 'woocommerce' ),
'4' => __('This product very famous.', 'woocommerce' )
);
}
Then you will call that function everywhere is needed:
In backend on your woocommerce_wp_select() code:
woocommerce_wp_select( array(
'id' => 'custom_text_field_title_110',
'label' => __( 'Awards', 'rasa_store' ),
'desc_tip' => true,
'description' => __( 'Select an option.', 'ctwc' ),
'options' => custom_field_options_title_110(), // <== Here we call our options function
) );
And now on frontend for single product page:
$attribute_11 = wc_get_product ( $post->ID );
$title_top_110 = $attribute_11->get_meta( 'custom_text_field_title_110' );
if( ! empty($title_top_110) ) {
printf( '<div class="row"><div class="col-md-4"><img class="img-fluid box-10-2" src="%s"></div>
<div class="col-md-8 box-10"><p class="card-text box-10-1">%s</p></div></div>',
esc_html( get_bloginfo('template_directory') . '/img/award-icon.png' ),
esc_html( custom_field_options_title_110()[$title_top_110] ) // <== HERE we use it
);
}
It should work…
Another alternative is to have the same keys and values in your 'options' array like:
$options_title_110 = array( '' => __( 'Select Option', 'woocommerce' ) );
foreach ( array(
__('This product does not win any awards', 'woocommerce' ),
__('This product win on award.', 'woocommerce' ),
__('This product win 2 award.', 'woocommerce' ),
__('This product win 3 award.', 'woocommerce' ),
__('This product very famous.', 'woocommerce' )
) as $label ) {
$options_title_110[$label] = $label;
}
woocommerce_wp_select( array(
'id' => 'custom_text_field_title_110',
'label' => __( 'Awards', 'rasa_store' ),
'desc_tip' => true,
'description' => __( 'Select an option.', 'ctwc' ),
'options' => $options_title_110,
) );
Then the custom field selected value will be saved on backend and displayed on front end.
You can set the options as you where doing, so this part should work as intended
add_action( 'woocommerce_product_options_general_product_data', 'woo_add_custom_text_field_title_110' );
function woo_add_custom_text_field_title_110(){
$title_110 = array(
'id' => 'custom_text_field_title_110',
'label' => __( 'Awards', 'rasa_store' ),
'desc_tip' => true,
'description' => __( 'Select an option.', 'ctwc' ),
'options' => array(
'' => __( 'Select Option', 'woocommerce' ),
'0' => __('This product does not win any awards', 'woocommerce' ),
'1' => __('This product win on award.', 'woocommerce' ),
'2' => __('This product win 2 award.', 'woocommerce' ),
'3' => __('This product win 3 award.', 'woocommerce' ),
'4' => __('This product very famous.', 'woocommerce' )
),
);
woocommerce_wp_select( $title_110 );
}
To save the fields
// Save Fields
add_action( 'woocommerce_process_product_meta', 'woo_add_custom_text_field_title_110_save' );
function woo_add_custom_text_field_title_110_save( $post_id ){
// Select
$title_top_110 = $_POST['custom_text_field_title_110'];
if( !empty( $title_top_110 ) )
update_post_meta( $post_id, 'custom_text_field_title_110', esc_attr( $title_top_110 ) );
else {
update_post_meta( $post_id, 'custom_text_field_title_110', '' );
}
}
And to output the data on single product page (this code needs to be modified to output it inside the loop)
$title_top_110 = get_post_meta( 'custom_text_field_title_110', $post->ID, true );
if( $title_top_110 ) {
printf(
'<div class="row">
<div class="col-md-4">
<img class="img-fluid box-10-2" src="%1$s/img/award-icon.png">
</div>
<div class="col-md-8 box-10">
<p class="card-text box-10-1">%2$s</p>
</div>
</div>
',
esc_html( get_bloginfo('template_directory') ),
esc_html( $title_top_110 )
);
}
In WooCommerce, based on "Dynamic synched custom checkout select fields in WooCommerce" answer code, I am adding some custom fields on checkout which will be displayed under the billing section on the e-mail confirmation
Here is my actual code:
add_action( 'woocommerce_after_checkout_billing_form', 'add_checkout_custom_fields', 20, 1 );
function add_checkout_custom_fields( $checkout) {
$domain = 'woocommerce'; // The domain slug
// First Select field (Master)
woocommerce_form_field( 'delivery_one', array(
'type' => 'select',
'label' => __( 'Art der Lieferung' , $domain),
'class' => array( 'form-row-first' ),
'required' => true,
'options' => array(
'' => __( 'Wählen Art der Lieferung.', $domain ),
'A' => __( 'Hauszustellung', $domain ),
'B' => __( 'Selbst Abholung', $domain ),
),
), $checkout->get_value( 'delivery_one' ) );
// Default option value
$default_option2 = __( 'Wählen Sie Zeitbereich.', $domain );
// Dynamic select field options for Javascript/jQuery
$options_0 = array( '' => $default_option2 );
$options_a = array(
'' => $default_option2,
'1' => __( '09:00-11:00', $domain ),
'2' => __( '10:00-12:00', $domain ),
'3' => __( '11:00-13:00', $domain ),
'4' => __( '12:00-14:00', $domain ),
'5' => __( '13:00-15:00', $domain ),
'6' => __( '14:00-16:00', $domain ),
'7' => __( '15:00-17:00', $domain ),
);
$options_b = array(
'' => $default_option2,
'1' => __( '01:00', $domain ),
'2' => __( '02:00', $domain ),
'3' => __( '03:00', $domain ),
'4' => __( '04:00', $domain ),
'5' => __( '05:00', $domain ),
'6' => __( '06:00', $domain ),
'7' => __( '07:00', $domain ),
'8' => __( '08:00', $domain ),
'9' => __( '09:00', $domain ),
'10' => __( '10:00', $domain ),
'11' => __( '11:00', $domain ),
'12' => __( '12:00', $domain ),
'13' => __( '13:00', $domain ),
'14' => __( '14:00', $domain ),
'15' => __( '15:00', $domain ),
'16' => __( '16:00', $domain ),
'17' => __( '17:00', $domain ),
'18' => __( '18:00', $domain ),
'19' => __( '19:00', $domain ),
'20' => __( '20:00', $domain ),
'21' => __( '21:00', $domain ),
'22' => __( '22:00', $domain ),
'23' => __( '23:00', $domain ),
'24' => __( '24:00', $domain ),
);
// Second Select field (Dynamic Slave)
woocommerce_form_field( 'delivery_two', array(
'type' => 'select',
'label' => __( 'Zeitspanne', $domain ),
'class' => array( 'form-row-last' ),
'required' => true,
'options' => $options_0,
), $checkout->get_value( 'delivery_two' ) );
$required = esc_attr__( 'required', 'woocommerce' );
// jQuery code
?>
<script>
jQuery(function($){
var op0 = <?php echo json_encode($options_0); ?>,
opa = <?php echo json_encode($options_a); ?>,
opb = <?php echo json_encode($options_b); ?>,
select1 = 'select[name="delivery_one"]',
select2 = 'select[name="delivery_two"]';
// Utility function to fill dynamically the select field options
function dynamicSelectOptions( opt ){
var options = '';
$.each( opt, function( key, value ){
options += '<option value="'+key+'">'+value+'</option>';
});
$(select2).html(options);
}
// 1. When dom is loaded we add the select field option for "A" value
// => Disabled (optional) — Uncomment below to enable
// dynamicSelectOptions( opa );
// 2. On live selection event on the first dropdown
$(select1).change(function(){
if( $(this).val() == 'A' )
dynamicSelectOptions( opa );
else if( $(this).val() == 'B' )
dynamicSelectOptions( opb );
else
dynamicSelectOptions( op0 ); // Reset to default
});
});
</script>
<?php
}
// Check checkout custom fields
add_action( 'woocommerce_checkout_process', 'wps_check_checkout_custom_fields', 20 ) ;
function wps_check_checkout_custom_fields() {
// if custom fields are empty stop checkout process displaying an error notice.
if ( empty($_POST['delivery_one']) || empty($_POST['delivery_two']) ){
$notice = __( 'Bitte wählen Sie die Versandart oder den Stundenbereich' );
wc_add_notice( '<strong>' . $notice . '</strong>', 'error' );
}
}
My custom fields and their values, are shown on the checkout form and on the order pages on back end. So far everything works great.
But the problem is that the e-mail that I receive does not contain the custom fields and their values.
How can I display that custom checkout billing fields on email notifications?
Is this code correct?
add_filter( 'woocommerce_email_format_string' , 'add_custom_email_format_string', 20, 2 );
function add_custom_email_format_string( $string, $email ) {
// The post meta key used to save the value in the order post meta data
$meta_key = '_delivery_one';
// Get the instance of the WC_Order object
$order = $email->object;
// Get the value
$value = $order->get_meta($meta_key) ? $order->get_meta($meta_key) : '';
// Additional subject placeholder
$new_placeholders = array( '{delivery_one}' => $value );
return str_replace( array_keys( $additional_placeholders ), array_values( $additional_placeholders ), $string );
}
You have to define a new placeholder that can be parsed.
add_filter( 'woocommerce_email_format_string' , 'add_custom_email_format_string', 20, 2 );
function add_custom_email_format_string( $string, $email ) {
// The post meta key used to save the value in the order post meta data
$meta_key = '_billing_field_newfield';
// Get the instance of the WC_Order object
$order = $email->object;
// Get the value
$value = $order->get_meta($meta_key) ? $order->get_meta($meta_key) : '';
// Additional subject placeholder
$new_placeholders = array( '{billing_field_newfield}' => $value );
// Return the clean replacement value string for "{billing_field_newfield}" placeholder
return str_replace( array_keys( $additional_placeholders ), array_values( $additional_placeholders ), $string );
}
Code goes in function.php file of your active child theme (or active theme). It will works.
Then in Woocommerce > Settings > Emails > "New Order" notification, you will be able to use the dynamic placeholder {billing_field_newfield}…
You should first save input value at the database as an order meta see here and then you can get the meta value in email template. All the email template of woocommerce is customizable and located at plugins/woocommerce/emails/
You can use this hook to store custom input field at order meta
do_action( 'woocommerce_checkout_order_processed', $order_id, $posted_data, $order );
Thanks
I have some custom fields for my Woocommerce products inside my Inventory Tab using woocommerce_wp_text_input() function. I would like to add one more custom text field just for displaying a value for reference.
I want to lock the textfield by default so as not to be able to write something in it.
Is it possible?
Yes it is possible adding the as custom_attributes the readonly property in the field arguments array using:
'custom_attributes' => array('readonly' => 'readonly'),
So your code will be like:
add_action( 'woocommerce_product_options_stock_status', 'display_product_options_inventory_custom_fields', 20 );
function display_product_options_inventory_custom_fields() {
global $post;
echo '</div><div class="options_group">'; // New separated section
// Text field (conditionally readonly)
woocommerce_wp_text_input( array(
'id' => '_text_field_ro',
'type' => 'text',
'label' => __( 'Read only field', 'woocommerce' ),
'placeholder' => __( 'placeholder text', 'woocommerce' ),
'description' => __( 'Custom description: your explanations.', 'woocommerce' ),
'desc_tip' => true,
'custom_attributes' => $readonly, // Enabling read only
) );
}
Code goes in function.php file of your active child theme (or active theme). Tested and works.
Update: Adding a checkbox to enable the readonly fields:
add_action( 'woocommerce_product_options_stock_status', 'display_product_options_inventory_custom_fields', 20 );
function display_product_options_inventory_custom_fields() {
global $post;
echo '</div><div class="options_group">'; // New separated section
// Checkbox
woocommerce_wp_checkbox( array(
'id' => '_enable_readonly',
'label' => __( 'Enable readonly fields', 'woocommerce' ),
'description' => __( 'Enable some fields to be readonly', 'woocommerce' ),
'desc_tip' => true,
));
// Get the checkbox value
$checkbox = get_post_meta( $post->ID, '_enable_readonly', true );
// We set the field attribute "readonly" conditionally based on the checkbox
$readonly = empty($checkbox) ? '' : array('readonly' => 'readonly');
// Text field 1 (conditionally readonly)
woocommerce_wp_text_input( array(
'id' => '_text_field_ro1',
'type' => 'text',
'label' => __( 'Read only field 1', 'woocommerce' ),
'placeholder' => __( 'placeholder text 1', 'woocommerce' ),
'description' => __( 'Custom description 1: your explanations.', 'woocommerce' ),
'desc_tip' => true,
'custom_attributes' => $readonly, // Enabling read only
) );
// Text field 2 (conditionally readonly)
woocommerce_wp_text_input( array(
'id' => '_text_field_ro2',
'type' => 'text',
'label' => __( 'Read only field 2', 'woocommerce' ),
'placeholder' => __( 'placeholder text 2', 'woocommerce' ),
'description' => __( 'Custom description 2: your explanations.', 'woocommerce' ),
'desc_tip' => true,
'custom_attributes' => $readonly, // Enabling read only
) );
}
add_action( 'woocommerce_process_product_meta', 'save_product_custom_fields' );
function save_product_custom_fields( $post_id ) {
// 1. readonly checkbox
$readonly = isset( $_POST['_enable_readonly'] ) ? esc_attr( $_POST['_enable_readonly'] ) : '';
update_post_meta( $post_id, '_enable_readonly', $readonly );
// 2. Readonly fields: allow saving when readonly is disabled
if( ! isset( $_POST['_enable_readonly'] ) ){
// Save text field 1 value
if( isset( $_POST['_text_field_ro1'] ) ){
update_post_meta( $post_id, '_text_field_ro1', sanitize_text_field( $_POST['_text_field_ro1'] ) );
}
// Save text field 2 value
if( isset( $_POST['_text_field_ro2'] ) ){
update_post_meta( $post_id, '_text_field_ro2', sanitize_text_field( $_POST['_text_field_ro2'] ) );
}
}
}
Code goes in function.php file of your active child theme (or active theme). Tested and works.
Checkbox is disabled (fields are not readonly):
Checkbox is enabled (fields are readonly):
The WordPress plugin WooCommerce supports Custom Fields.
Custom Fields can be toggled under Screen Options:
However, these Custom Fields do no get segregated for product variations. There is only one set of Custom Fields that applies to all product variations in the WooCommerce interface, and this is inappropriate because different product variations may have different product MPNs, for example, which is one of the Custom Fields I have set up for myself.
The closest off-site solution I found does not link up to custom fields. The code, shown below, shows how one can set up input fields in the Product Variations interface. How can I modify the solution below to link up the Product Variations interface the custom fields?
This question is distinct from questions concerned with Advanced Custom Fields, as I am not using that plugin. Furthermore, at least one other similar question on Stack Overflow but I'm not proficient with PHP and I don't comprehend it, nor do I know if it is relevant - but I will point out that solution has not been accepted by the OP and I don't want to necropost there.
/**
* Create new fields for variations
*
*/
function variation_settings_fields( $loop, $variation_data, $variation ) {
// Text Field
woocommerce_wp_text_input(
array(
'id' => '_ean_code[' . $variation->ID . ']',
'label' => __( 'EAN-CODE', 'woocommerce' ),
'placeholder' => 'EAN-CODE',
'desc_tip' => 'true',
'description' => __( 'Enter your custom EAN code.', 'woocommerce' ),
'value' => get_post_meta( $variation->ID, '_ean_code', true )
)
);
woocommerce_wp_text_input(
array(
'id' => '_stock_amsterdam[' . $variation->ID . ']',
'label' => __( 'Nr. of Stock in Amsterdam', 'woocommerce' ),
'desc_tip' => 'true',
'description' => __( 'Enter nr. of Stock in Amsterdam', 'woocommerce' ),
'value' => get_post_meta( $variation->ID, '_stock_amsterdam', true ),
'custom_attributes' => array(
'step' => 'any',
'min' => '0'
)
)
);
woocommerce_wp_text_input(
array(
'id' => '_stock_den_bosch[' . $variation->ID . ']',
'label' => __( 'Nr. of Stock in Den Bosch', 'woocommerce' ),
'desc_tip' => 'true',
'description' => __( 'Enter nr. of Stock in Den Bosch', 'woocommerce' ),
'value' => get_post_meta( $variation->ID, '_stock_den_bosch', true ),
'custom_attributes' => array(
'step' => 'any',
'min' => '0'
)
)
);
woocommerce_wp_text_input(
array(
'id' => '_stock_alkmaar[' . $variation->ID . ']',
'label' => __( 'Nr. of Stock in Alkmaar', 'woocommerce' ),
'desc_tip' => 'true',
'description' => __( 'Enter nr. of Stock in Alkmaar', 'woocommerce' ),
'value' => get_post_meta( $variation->ID, '_stock_alkmaar', true ),
'custom_attributes' => array(
'step' => 'any',
'min' => '0'
)
)
);
}
/**
* Save new fields for variations
*
*/
function save_variation_settings_fields( $post_id ) {
// Text Field
$text_field = $_POST['_ean_code'][ $post_id ];
if( ! empty( $text_field ) ) {
update_post_meta( $post_id, '_ean_code', esc_attr( $text_field ) );
}
$number_field = $_POST['_stock_amsterdam'][ $post_id ];
if( ! empty( $number_field ) ) {
update_post_meta( $post_id, '_stock_amsterdam', esc_attr( $number_field ) );
}
$number_field = $_POST['_stock_den_bosch'][ $post_id ];
if( ! empty( $number_field ) ) {
update_post_meta( $post_id, '_stock_den_bosch', esc_attr( $number_field ) );
}
$number_field = $_POST['_stock_alkmaar'][ $post_id ];
if( ! empty( $number_field ) ) {
update_post_meta( $post_id, '_stock_alkmaar', esc_attr( $number_field ) );
}
}
// Save Variation Settings
add_action( 'woocommerce_save_product_variation', 'save_variation_settings_fields', 10, 2 );
// Add Variation Settings
add_action( 'woocommerce_product_after_variable_attributes', 'variation_settings_fields', 10, 3 );
The WooCommerce bookings extension has the following for adding some text to the calendar label:
<?php
$booking_form_params = array(
'ajax_url' => admin_url( 'admin-ajax.php' ),
'i18n_date_unavailable' => __( 'This date is unavailable', 'woocommerce-bookings' ),
'i18n_date_fully_booked' => __( 'This date is fully booked and unavailable', 'woocommerce-bookings' ),
'i18n_date_partially_booked' => __( 'This date is partially booked - but bookings still remain', 'woocommerce-bookings' ),
'i18n_date_available' => __( 'This date is available', 'woocommerce-bookings' ),
'i18n_start_date' => __( 'Choose a Start Date', 'woocommerce-bookings' ),
'i18n_end_date' => __( 'Choose an End Date', 'woocommerce-bookings' ),
'i18n_dates' => __( 'Dates', 'woocommerce-bookings' ),
'i18n_choose_options' => __( 'Please select the options for your booking above first', 'woocommerce-bookings' ),
);
wp_localize_script( 'wc-bookings-booking-form', 'booking_form_params', apply_filters( 'booking_form_params', $booking_form_params ) );
?>
I'd like to modify the start and end dates but I'm not sure how to add those filters. Any help appreciated.
I figured this out. In case it helps anyone...
add_filter( 'booking_form_params', 'checkin_checkout' );
function checkin_checkout( $labels ) {
foreach ( $labels as $key => $label ) {
if ( $key == 'i18n_start_date' ) {
$labels[$key] = 'Please choose a check-in date';
}
if ( $key == 'i18n_end_date' ) {
$labels[$key] = 'Please choose a check-out date';
}
}
return $labels;
}