Posted: September 8, 2016 at 8:14 am
|
Hello, As the site we’re building is mainly UK based, we’d like to change the wording ‘Cart’ to ‘Basket’. I was just wondering what the best way to do this would be? If there might be a way to globally change it or if I’d have to do it individually, and if so how would I best go about this? Thanks, Harry. |
Hi Harry, Here is an example that can be added to a site specific plugin (https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/) to update the messaging: https://gist.github.com/joshfeck/ff986f3e848a2b910c47#file-change_mer_cart_name-php You can change cart in the example to Basket. — |
|
Hi Harry,
The easiest method to do this is to ‘translate’ the text to whatever you prefer. However you can’t globally change all instances of ‘cart’ in one go, any strings that use ‘cart’ as part of a string need to individually translated. For example, translating ‘cart’ to basket will not change ‘Event Cart’ to Event Basket as it’s a different string. Generally within EE we use ‘Event Cart’ so you could translate that to ‘Basket’ and that actually should cover most areas. To do that you can use a function like the one shown here: https://eventespresso.com/wiki/how-to-change-wording-with-poedit/#custom-function Like this: https://gist.github.com/Pebblo/cde9d94c944bd6fc1a1d34d6dccd35c0 You can add that to your themes functions.php file or a Custom Functions Plugin. It depends which feature you are using if that covers all areas you need, can you link me to the page you want to change so can see? |
|
|
Hey Both, Thanks for your help, it’s much appreciated 🙂 You’ve given me a few options, is there a ‘best’ method? The page you can see the basket on is here; http://aerosol.deckchair.co.uk/events/ddl27-2016/ if you scroll down to the ticket selector, choose 1 ticket and put some random details in and select a role you’ll see the popup with the cart link. If you could let me know the best method, I’ll have a shot at making the change. Thanks, Harry. |
They actually both do almost exactly the same thing. The code that outputs the cart name is this:
Josh’s example uses the filter, mine uses the translation function that the name is wrapped around – Josh’s example would likely run a little quicker than mine so out of the 2 I’d go with that one an you can still add that to either functions.php or a Custom Functions Plugin. Any problems just let us know. |
|
|
Hey again, That’s great, thanks. I first tried the filter method which worked perfectly. I then realised there were a few things to change and decided to switch to using the translation method instead which is also working perfectly! One small thing i tried is change ‘items’ to ‘tickets’ but this didn’t translate. I tried adding ‘items’ > ‘tickets’ to the function but to no avail. Is this due to what you were describing before about it being part of the string rather than a whole string so it won’t translate? Thanks for all your help. Harry. |
Hi Harry,
Yes it is. You will need to translate the entire string. |
|
|
Thought so, that’s a shame. The problem is I’m looking to translate these; ‘There is currently X item/s in the Event Cart. > There is currently 1 ticket in your basket’ The problem here is firstly the number changes so I can’t change the whole string and also the plural of items may change. Am I going to have to leave this of am I able to change it with another method? Thanks, Harry. |
We account for both of those situations within the translations 🙂 So this time you will need to use the translation although slightly different than the other. Take a look at this: https://gist.github.com/Pebblo/40b0ee35ac6841f0153498305ad4888c Note that filter is separate from the other, you can not just add the strings to the other function.
|
|
|
Perfect! All has been solved, thanks so much for your time/explanation. The site is due to go live next week so it’s nice to get it all cleaned up before hand. Thanks, Harry. |
Great 🙂 Any further questions just let us know. |
|
The support post ‘Changing 'Cart' to 'Basket'’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.