henrikL-12
|
I am using a code snippet to hide prices, if the user is not logged in.
It looks like this:
add_filter( 'woocommerce_get_price_html', 'bbloomer_hide_price_addcart_not_logged_in', 9999, 2 );
function bbloomer_hide_price_addcart_not_logged_in( $price, $product ) {
if ( ! is_user_logged_in() ) {
$price = '<div>' . __( 'Log ind for at se priser', 'bbloomer' ) . '</div>';
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
}
return $price;
}
I want to translate the line "Log ind for at se priser" (Danish), to "Login to see prices" (English).
The site uses (off course) WPML
|
Andreas
|
Hello there
Thank you for contacting us. I am happy to help you.
If the snippet is in theme's function php, please rescan theme to find new strings and then add translation to String Translation.
I am sharing a few docs to read more.
https://wpml.org/documentation/getting-started-guide/string-translation/finding-strings-that-dont-appear-on-the-string-translation-page/
https://wpml.org/documentation/support/enabling-text-translation-for-themes-not-compatible-with-wpml/
I hope this helps. Please let us know how it goes or if you need any further assistance. I'll gladly help you. 🙂
Regards,
Andreas
|