# Implementing Custom Link Translation

By default, Weglot translates links based on specific patterns. However, in some cases, you may want to handle link translations manually. Below, we provide an example of a function to translate a WooCommerce product link. You can customize this method further, such as adding specific languages you wish to translate the link into.

```php
function weglot_get_current_full_product_by_id($product_id) {
	$post = get_post($product_id);
	if ($post && $post->post_type === 'product') {
		$product_url = get_permalink( $product_id );
	}
	return weglot_create_url_object( $product_url )->getForLanguage( weglot_get_request_url_service()->get_current_language() );
}
echo weglot_get_current_full_product_by_id(17);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.weglot.com/wordpress/use-cases/implementing-custom-link-translation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
