Change or translate specific texts in Woocommerce
i found this for the child functions.php: http://speakinginbytes.com/2013/10/gettext-filter-wordpress/
/** * Change text strings * * @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext */function my_text_strings( $translated_text, $text, $domain ) { switch ( $translated_text ) { case 'Related Products' : $translated_text = __( 'Check out these related products', 'woocommerce' ); break; } return $translated_text;}add_filter( 'gettext', 'my_text_strings', 20, 3 );
it works well here: https://mo-sound.com/en/shop/ball-speaker-classic-white/
The best way to override default templates is to copy the file to a folder named /woocommerce/single-product
inside your current theme. Make changes to that file.
In general to override Woocommerce template files like
/wp-content/plugins/woocommerce/templates/<foldername>/<filename>
you copy the file to
/wp-content/<your-theme>/woocommerce/<foldername>/<filename>
Here is user5217948
's code with the needed case update from Frithir
:
// CHANGE RELATED PRODUCTS TEXTfunction my_text_strings( $translated_text, $text, $domain ) { switch ( $translated_text ) { case 'Related products' : $translated_text = __( 'You may also like...', 'woocommerce' ); break; } return $translated_text;}add_filter( 'gettext', 'my_text_strings', 20, 3 );
This code works with WooCommerce 3.3.1 and WordPress 4.9.4 (both circa Feb 2018).
.