• Resolved thelyall

    (@thelyall)


    In the standard WooCommerce customiser settings you can amend the terms and conditions acceptance text, and you can also replace the [terms] shortlink with whatever html link you want.

    However, if you do that and use a custom link, the terms text no longer loads in a nice embedded frame and instead the link opens in a new page like a normal link.

    How can I change the ‘terms and conditions’ link title that is displayed when using the shortlink. Specifically I need it to say ‘terms of use’ instead, but behave in the same way as the [terms] shortcode. Can this be done with a custom function in the child theme?

    I’ve found what I need to change is the $terms_link in line 906 of wc-template-functions.php but I don’t know how to do this with a hook, as I can’t override files in the /includes folder from my child theme.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Phil

    (@fullysupportedphil)

    Automattic Happiness Engineer

    @thelyall our team isn’t able to offer custom coding advice, however if you want to maintain the current function and simply change the text – the easiest solution would be to translate that text. You can do that by adding your own translation manually, or simply using a plugin like Loco Translate

    Thread Starter thelyall

    (@thelyall)

    Does Loco Translate translate on the server side? As I use a third party translation service on the front end to translate the site into 68 different languages, so I need the code to be translatable (it can’t translate things added on the client side). Thanks

    Phil

    (@fullysupportedphil)

    Automattic Happiness Engineer

    If you already use a translation plugin, then you could do this with that.

    I’m not sure what you mean by server-side versus client-side. Loco Translate is a plugin you’d run on your site, so all of the work is done server-side before the site is served to your client’s browser. Nothing is done by your client’s browser in the process.

    The plugin works by creating a new language file for whichever plugin you are translating. These files live on your site, just the same as if you were to manually make you own .pot files.

    Thread Starter thelyall

    (@thelyall)

    Thanks for the explanation.

    I’ll have to find another way though I think – I installed the plugin and it’s a bit of a sledgehammer to crack a walnut when I only need to change two words in the entire site. I need to keep the site as lean as possible.

    Thanks for your help,
    Lyall

    Phil

    (@fullysupportedphil)

    Automattic Happiness Engineer

    You can make your own translation file and skip using a plugin as I mentioned above.

    The plugin is just a tool to make creating language files easier. You can manually create your own language file and then add it to your site. There are guides on this, including ours which covers doing this with PO Edit, though you could really use any text editor:
    https://docs.woocommerce.com/document/woocommerce-localization/#section-7

    Thread Starter thelyall

    (@thelyall)

    I solved it with this snippet – thanks for pointing me in the right direction with the translations:

    function translate_terms_strings( $translated, $untranslated, $domain ) {
       if ( ! is_admin() && 'woocommerce' === $domain ) {
          switch ( $translated) {
             case 'terms and conditions' :
                $translated = 'terms of use';
                break;     
          }
       }   
       return $translated;
    }

    I am trying to resolve this issue as well, but @thylyall’s snippet doesn’t work for me. Can someone please assist?

    I need to change “terms and conditions” to “terms of sales”.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to edit [terms] shortcode link text from child theme?’ is closed to new replies.