Loading WooCommerce translation from custom location

I’m trying to load a WooCommerce translation from a custom directory called “languages” inside my child theme, so I added this function to my functions.php file but it isn’t working:

// Loads WooCommerce custom translation from custom location
add_filter( ‘load_textdomain_mofile’, ‘load_custom_plugin_translation_file’, 10, 2 );

function load_custom_plugin_translation_file( $mofile, $domain ) {
if ( ‘woocommerce’ === $domain ) {
$mofile = WP_LANG_DIR . ‘/languages/woocommerce-‘ . get_locale() . ‘.mo’;
}
return $mofile;
}

Any idea on what I’m missing? Can anyone point me in the right direction? Any help will be appreciated. Thanks in advance.

Read more here:: Loading WooCommerce translation from custom location

Leave a Reply

Your email address will not be published. Required fields are marked *