Edit “Add gift wrap?” Text
-
Hi again!
By default the button is “Add gift wrap?”
Where do I edit this?
Is it easy to edit in the paid version?
-
Hi again @caitlincorrigan
You can use translations to change the wording (see below), or use filter hooks to change the wording, or gamble and override templates included with the plugin with templates in your (child) theme to change the wording. It’s the same in the free and paid version, with more options than, say WooCommerce would give for changing text.
I recommend getting your developer involved. And also, please review the FAQ. https://www.ads-software.com/plugins/woocommerce-gift-wrapper/#faq
Here is how to do it using the filter hook built into the plugin. You will probably want to use the plugin Code Snippets to run this code, unless you have a child theme and are comfortable editing your functions.php file.
function my_change_wrap_prompt( $prompt ) { // your newly worded prompt below, after $prompt =, between '' apostrophes // cannot contain ' as punctuation unless escaped with a \, $prompt = 'Would you like to wrap this?'; return $prompt; } add_filter( 'wcgwp_add_wrap_prompt', 'my_change_wrap_prompt', 11, 1 );
Other lines can be changed in similar way, using their own filter hooks. Or go the Poedit/translate way.
-
This reply was modified 4 years, 10 months ago by
Little Package.
I tried to change the text using the code snippet and added your code but it did not change the text? Did I do something wrong?
Any chance you can explain a bit more on how to do this for a noobie, please? The plugin is awesome and doing exactly what I wanted, just the text is not the right wording.
Many thanks in advance
-
This reply was modified 4 years, 9 months ago by
glockett.
@glockett It’s hard to say without seeing what your code looked like, but maybe try this instead, to help ensure the filter hook isn’t fired too early during WP loading:
function my_change_wrap_prompt( $prompt ) { // your newly worded prompt below, after $prompt =, between '' apostrophes // cannot contain ' as punctuation unless escaped with a \, $prompt = 'Would you like to wrap this?'; return $prompt; } function my_add_wcwgp_filter() { add_filter( 'wcgwp_add_wrap_prompt', 'my_change_wrap_prompt', 11, 1 ); } add_action( 'after_setup_theme', 'my_add_wcwgp_filter' );
Thank you for your message, it is much appreciated. So what I have done is installed the code snippets plugin as suggested. Then added a new snippet by copying your code and then set this to fire ‘Only run on site front end’.
That’s it …do need to do anything else?
@glockett
Sorry for the delay and thanks for your patience. I just got a chance to look at this. I’m sorry I was mistaken, the free version does not have filters for the text. I can add some for the next version, but meanwhile you’ll need to either use the templating system or WP translations to change the text.Hi @caitlincorrigan,
I haven’t heard back from you here and so I am going to close this support request topic. We have been in touch by email, and can stay in touch that way if you like. Thank you!
Is there a filter in current version for this?
We would like to use plugin for message cards, so the “Add gift wrap?” text is not appropriate.
Many Thanks
-
This reply was modified 4 years, 9 months ago by
phirefly. Reason: Notify me of follow-up replies via email
Not yet but probably soon (it’s in the next release which is waiting until I have time to test it). That said, the plugin comes with a .POT file just for this type of need. It’s translation-ready, so there’s not much stopping you from customizing the plugin text the standard way using something like Poedit or Loco Translate.
Hi @littlepackage
we are using the filters for this, but are having problem with the ‘wcgwp_add_wrap_button_text’ which seems to append the new text to the default.eg. echo ‘Add card to order’; results in; “Add Gift Wrap To OrderAdd Card To Order” being displayed.
Screenshot: https://monosnap.com/file/DNSb3he26kUWkrL76ElRmpEgVW3AEr
Do you have any idea why this might happen?
The ‘wcgwp_add_wrap_prompt’ filter is working perfectly ??
Thanks
Hi @phirefly
Yes I can see exactly what is causing that ??
I’ve issued a plugin update, version 4.2.3, which should solve that issue. Thanks for pointing it out! -
This reply was modified 4 years, 10 months ago by
- The topic ‘Edit “Add gift wrap?” Text’ is closed to new replies.