Created
November 13, 2012 16:30
-
-
Save WebEndevSnippets/4066777 to your computer and use it in GitHub Desktop.
WooCommerce: Change Order Notes Placeholder Text
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_checkout_fields', 'webendev_woocommerce_checkout_fields' ); | |
/** | |
* Change Order Notes Placeholder Text - WooCommerce | |
* | |
*/ | |
function webendev_woocommerce_checkout_fields( $fields ) { | |
$fields['order']['order_comments']['placeholder'] = 'Your custom placeholder'; | |
return $fields; | |
} |
I have personalized the Custom Order Notes Text and made it required and works ok but the placeholder text when you type in gets out of the text field. any solution? This is the code i´ve used in the theme child functions.php
<?php
// Add custom Theme Functions here
// WC order notes field
add_filter('woocommerce_checkout_fields', 'custom_woocommerce_checkout_fields');
function custom_woocommerce_checkout_fields( $fields ) {
$fields['order']['order_comments']['placeholder'] = 'Horario de Entrega y Notas Pedido | Península: Indique una franja de 3h entre las 9h y las 19h | Alcorcón: Elija horario Mañanas de 12h a 14h y/o Tardes de 17h a 19h';
return $fields;
}
/*-----------------------------------------------------------------------------------*/
/* WooCommerce - Change Checkout Notes Label and Place Holder Text
/*-----------------------------------------------------------------------------------*/
// Hook in
add_filter( 'woocommerce_checkout_fields' , 'theme_override_checkout_notes_fields' );
// Our hooked in function - $fields is passed via the filter!
function theme_override_checkout_notes_fields( $fields ) {
$fields['order']['order_comments']['placeholder'] = 'Horario de Entrega y Notas del Pedido | Península: Indique una franja de 3h entre las 9h y las 19h | Alcorcón: Elija horario Mañanas de 12h a 14h y/o Tardes de 17h a 19h*';
$fields['order']['order_comments']['label'] = 'Horario de Entraga y Notas del Pedido';
return $fields;
}
// Hacer campo notas pedido obligatorio. Place this code in your theme's functions.php file
// Hook in
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields( $fields ) {
$fields['order']['order_comments']['required'] = true;
return $fields;
}
Screesnhot
link
Woohoo! Thanks. Saved me time here.
Great. Thanks.
Thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Simple & useful. Appreciate the upload.