For the complete documentation index, see llms.txt. This page is also available as Markdown.

Plugin WooCommerce: Translate Product URLs

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

Weglot lets you translate the URL slug of your WooCommerce products directly from the product edit screen: a Weglot metabox appears at the bottom of the product page, where you can set a translated slug for each language.

This metabox is available for every public post type except a few that are excluded by default: attachment, shop_order and shop_coupon. You can change that list with the weglot_url_translate_metabox_post_type_exclude filter.

For example, to also hide the translated-slug metabox for products:

add_filter( 'weglot_url_translate_metabox_post_type_exclude', 'custom_weglot_metabox_exclude' );
function custom_weglot_metabox_exclude( $excluded ) {
	$excluded[] = 'product';
	return $excluded;
}

Or to re-enable it for a post type that is excluded by default (here shop_coupon):

add_filter( 'weglot_url_translate_metabox_post_type_exclude', 'custom_weglot_metabox_include' );
function custom_weglot_metabox_include( $excluded ) {
	$index = array_search( 'shop_coupon', $excluded, true );
	if ( $index !== false ) {
		unset( $excluded[ $index ] );
	}
	return $excluded;
}

Last updated