PVT has multiple fields where you can add custom text. The ability to add custom text replacing the default adds flexibility. Unfortunately, you will face one complexity when you try to translate dynamic text.
WordPress Translation Plugins do not allow the translation of dynamic texts. Here is what Loco Translate says about translating dynamic texts.
To help you avoid this and translate dynamic text on PVT, we have come up with a solution. You will have to add a code snippet to your site.
Translating Dynamic Available Options Button Text
The Available Options Button Text comes with the text (string) Available options. Let’s say you want to change/customize it to View Options. Changing the settings will not allow you to translate the text. You will have to add the following snippet to your site.
//Code Snippet for Custom Available Options Button Text
add_filter('pvtfw_available_options_btn_text', function($btn_text){
$btn_text = __('View Options', 'product-variant-table-for-woocommerce');
return $btn_text;
}, 10, 1);
💡️
You can add the snippet to your child theme’s functions.php file. We recommend using a child theme rather than modifying the parent (original) theme. Otherwise, future updates to the theme will override your customization.
You can also add it as a snippet using the Code Snippets plugin.
Translating Dynamic Cart Button Text
By default, the Cart Button Text comes with the text (string) Add To Cart. If you want to change it to Cart. You must add the following snippet to your site.
//Code Snippet for Custom Cart Button Text
add_filter('pvtfw_cart_btn_text', function($btn_text){
$btn_text = __('Cart', 'product-variant-table-for-woocommerce');
return $btn_text;
}, 10, 1);
Once, you have added the code, you can translate the dyn
Was this article helpful?
YesNo