Category Archives: Snippet

WooCommerce – Change “Related Products” text

This snippet allows to quickly change the “Related products” text which is shown by default at the bottom of a single product page in a WooCommerce shop.

Check out on my test environment: https://shop.nicolasrabier.com/product/woo-album-4/

Insert the code in functions.php of your child theme.

/**
* Change text strings
*
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/

function custom_related_products_text( $translated_text, $text, $domain ) {
  switch ( $translated_text ) {
    case 'Related products' :
      $translated_text = __( 'Other items you might like', 'woocommerce' );
      break;
  }
  return $translated_text;
}
add_filter( 'gettext', 'custom_related_products_text', 20, 3 );