Home › Forums › Ticket Products › Event Tickets Plus › Want to change the label and placeholder text at checkout? Check this out!
- This topic has 2 replies, 3 voices, and was last updated 8 years, 6 months ago by Support Droid.
-
AuthorPosts
-
October 10, 2015 at 7:59 pm #1013507TommyParticipant
At checkout, you have a section “Additional Information” and in there for order comments you have a label called: “Order Notes” and in there you have the placeholder it has the following text: “Notes about your order, e.g. special notes for delivery.”
Now if you are selling tickets, that looks dumb. So in my case i want to make the following changes:
I want “Additional Information” to say “Did you buy a ticket for a friend?”
I want “Order Notes” to say “Please enter your friends names that you purchased a ticket for”
I want “Notes about your order, e.g. special notes for delivery.” to say “Enter full name here..”I also want “Out of stock” to say “ALL TICKETS SOLD” for when all tickets are sold.
The code:
add_filter('gettext', 'translate_text'); add_filter('ngettext', 'translate_text'); function translate_text($translated) { $translated = str_ireplace('Out of stock', 'ALL TICKETS SOLD', $translated); $translated = str_ireplace('Additional Information', 'Did you buy a ticket for a friend?', $translated); return $translated; } // 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']['label'] = 'Personalized Message'; $fields['order']['order_comments']['placeholder'] = 'Add message here'; return $fields; }
Add this to your functions.php – It can be added at the bottom above the last line. Ideally you’d want to add it to your child theme functions.php
Example of where you can place it:
$excerpt_length = fusion_get_theme_option( 'excerpt_length_blog' ); $sermon_content .= Avada()->blog->get_content_stripped_and_excerpted( $excerpt_length, $description ); } return $sermon_content; } add_filter('gettext', 'translate_text'); add_filter('ngettext', 'translate_text'); function translate_text($translated) { $translated = str_ireplace('Out of stock', 'ALL TICKETS SOLD', $translated); $translated = str_ireplace('Additional Information', 'Did you buy a ticket for a friend?', $translated); return $translated; } // 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']['label'] = 'Personalized Message'; $fields['order']['order_comments']['placeholder'] = 'Add message here'; return $fields; } // Omit closing PHP tag to avoid "Headers already sent" issues.
Tell me i’m a rockstar? =p
October 12, 2015 at 6:49 am #1013634BrianKeymasterHi Tommy,
Thanks for sharing this coding you are indeed a Rockstar!
Also, look for a more advanced version of collecting custom information in a future release of our ticketing plugins, hopefully in the next release.
I am going to share this coding with the team so we are aware of it and can suggest it to other people.
Thanks Again.
October 27, 2015 at 7:05 am #1018820Support DroidKeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Want to change the label and placeholder text at checkout? Check this out!’ is closed to new replies.