Change related product text to related reviews

This topic has 5 replies, 2 voices, and was last updated 2 years, 5 months ago ago by Rose Tyler

  • Avatar: Sadikul Islam
    Sadikul Islam
    Participant
    June 23, 2022 at 08:05

    hi, i am trying to change related product text to something else, for that I am using a PHP code but that is not working.
    the code is:
    // Change WooCommerce “Related products” text

    add_filter(‘gettext’, ‘change_rp_text’, 10, 3);
    add_filter(‘ngettext’, ‘change_rp_text’, 10, 3);

    function change_rp_text($translated, $text, $domain)
    {
    if ($text === ‘Related products’ && $domain === ‘woocommerce’) {
    $translated = esc_html__(‘Check out our other products’, $domain);
    }
    return $translated;
    }

    Can you find me a better solution to change related products to something else on the product page?

    4 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 23, 2022 at 08:53

    Hello,

    This text comes from the theme, so you can use translation files to change it. Install and activate Loco Translate plugin > create a translation for XStore theme > change English text and disable the Loco plugin https://www.8theme.com/documentation/xstore/theme-translation/base-theme-translation/

    Regards

    Avatar: Sadikul Islam
    Sadikul Islam
    Participant
    June 23, 2022 at 17:44

    It wroked.
    Thank you very much.

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 24, 2022 at 06:41

    You’re welcome!
    Have a nice day!

    Regards

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 26, 2022 at 13:54

    Hello,

    We’d appreciate if you could take a moment to give us 5-stars on ThemeForest! https://themeforest.net/downloads

    Regards

  • Viewing 5 results - 1 through 5 (of 5 total)

The issue related to '‘change related product text to related reviews’' has been successfully resolved, and the topic is now closed for further responses

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.