Home › Forums › Ticket Products › Event Tickets Plus › Change WooCommerce Button Text "Add to cart"
- This topic has 12 replies, 2 voices, and was last updated 8 years, 6 months ago by
Joël Schmid.
-
AuthorPosts
-
October 17, 2017 at 3:31 am #1364491
Joël Schmid
ParticipantHello
There seem to be a couple of people who would like to rename the “Add to cart” button when using WooCommerce for selling tickets. However, all the forum posts about this topic didn’t present an adequate solution. Using the Woocommerce filter doesn’t seem to work for this button: https://docs.woocommerce.com/document/change-add-to-cart-button-text/
Furthermore, using WooCommerce plugins to change to button text have the same result. Therefore, I assume that this is an “Events Calendar” issue?Thank you in advance for your help.
Cheers, Joël
October 17, 2017 at 9:51 pm #1365122Geoff B.
MemberGood evening Joël and welcome to the Events Calendar Support forum!
Thank you for reaching out to us.
I would love to help you with this topic.The “Add to cart” text is found in Event Tickets Plus strings.
It can therefore be changed by:- Customizing the language file
- Using a snippet in the functions.php file of your theme (without the PHP tag at the top): https://theeventscalendar.com/knowledgebase/change-the-wording-of-any-bit-of-text-or-string/
I highly recommend reading the 3 following articles on translation:
- https://theeventscalendar.com/knowledgebase/translating-the-events-calendar/
- https://theeventscalendar.com/knowledgebase/how-to-override-plugin-language-files/
- https://theeventscalendar.com/knowledgebase/incomplete-translations/
Let me know how that goes.
Best regards,
Geoff B.October 18, 2017 at 12:20 am #1365163Joël Schmid
ParticipantHey there,
Thanks for your help.
I tried with the following code, but something doesn’t seem to work. What am I doing wrong?
`function tribe_custom_theme_text ( $translation, $text, $domain ) {
// Put your custom text here in a key => value pair
// Example: ‘Text you want to change’ => ‘This is what it will be changed to’
// The text you want to change is the key, and it is case-sensitive
// The text you want to change it to is the value
// You can freely add or remove key => values, but make sure to separate them with a comma
// This example changes the label “Venue” to “Location”, and “Related Events” to “Similar Events”
$custom_text = array(
‘In den Warenkorb’ => ‘Jetzt für die Tour anmelden!’,
);// If this text domain starts with “tribe-“, “the-events-“, or “event-” and we have replacement text
return $translation;
}
add_filter(‘gettext’, ‘tribe_custom_theme_text’, 20, 3);October 18, 2017 at 8:32 am #1365346Geoff B.
MemberGood morning Joël,
Thank you for writing back.
You are almost there. What needs to change is that the initial string needs to be in English.
In your case that means “In den Warenkorb” should read “Add to cart”.Let me know how that goes.
Best regards,
Geoff B.October 19, 2017 at 1:30 am #1365811Joël Schmid
ParticipantHello Geoff
I adapted the script to the following, however, the button didn’t get relabled (Site and Browser Cache was deleted).
` $custom_text = array(
‘Add to cart’ => ‘Jetzt für die Tour anmelden!’,
);Something seems to be missing?
October 20, 2017 at 12:08 am #1366323Geoff B.
MemberGood evening Joël.
Without taking a look at the files, it’s hard to say what is going on exactly.
Could you please send me a copy of the latest version of your WordPress theme / child theme via a link to a .zip file link (stored Dropbox or Google Drive) so that I can run some tests on my end ? I recommend a private reply for that purpose.
Please ensure you are using the latest files as found on your actual website.
This way I will get access to any updates or customizations you might have made.Hang in there!
Geoff B.
October 22, 2017 at 8:05 am #1367291Joël Schmid
ParticipantThis reply is private.
October 23, 2017 at 8:39 pm #1367854Geoff B.
MemberThis reply is private.
October 23, 2017 at 11:39 pm #1367894Joël Schmid
ParticipantThis reply is private.
October 25, 2017 at 11:44 pm #1369020Geoff B.
MemberThis reply is private.
October 26, 2017 at 1:05 am #1369024Joël Schmid
ParticipantHey Geoff
Awesome, thanks for your help! I replaced the deprecated function and completed the snippet, now everything is working as expected, thanks!
October 26, 2017 at 9:25 am #1369257Geoff B.
MemberGood afternoon Joël,
I am super stoked to hear that.
You are welcome back in our support forums any time 🙂
For now, I am going to close this thread.
Have a great week!
Geoff B.
-
AuthorPosts
- The topic ‘Change WooCommerce Button Text "Add to cart"’ is closed to new replies.
