This code changes the description title to 'Attributes' on both English(en) and Thai(th) products on the site. But Obviously it needs to return this only for the English version, and return 'คุณลักษณะ' for the Thai products.
add_filter('woocommerce_product_description_heading','switch_product_description_heading');
function switch_product_description_heading() {
return 'Attributes';
}
I have tried this to grab PolyLang's current language but has no effect:
function language_switch() {
if(pll_current_language=='en') {
add_filter( 'woocommerce_product_description_heading', 'switch_product_description_heading' );
function switch_product_description_heading() {
return 'Attributes';
}
} elseif (pll_current_language=='th') {
add_filter( 'woocommerce_product_description_heading', 'switch_product_description_heading' );
function switch_product_description_heading() {
return 'คุณลักษณะ';
}
}
}
Any help would be appreciated!
pll_current_language
is a function so you should call it
if(pll_current_language() =='en') {