Plugin WooCommerce: Translate Product URLs

By default, Weglot doesn't allow you to translate product URL, you can do it following this

Enter the following code in your functions.php file. Then you will be able to edit the slug of your products directly in the WordPress backend, on the bottom of the product page.

<?php

add_filter('weglot_url_translate_metabox_post_type_exclude', 'active_metabox_translate_url');
function active_metabox_translate_url($excluded){
    $index = array_search('product', $excluded);
    if($index < 0){
        return $excluded;
    }
    
    unset($excluded[$index]);
    return $excluded;
}

Last updated