Skip to content

Instantly share code, notes, and snippets.

@goliver79
Last active May 19, 2016 14:02
Show Gist options
  • Save goliver79/8824504 to your computer and use it in GitHub Desktop.
Save goliver79/8824504 to your computer and use it in GitHub Desktop.
[WOOCOMMERCE] Translate product variations labels and names using filters
<?php
/**
*
* Translate product variations labels and names with filters
* lgpd_translate_attributes_label
* lgpd_translate_variation_option_name
*/
add_filter( 'woocommerce_variation_option_name', 'translate_variation_option_name' );
add_filter( 'woocommerce_attribute_label', 'translate_attributes_label' );
function translate_attributes_label( $result ){
return __( $result, 'my_textdomain' );
}
function translate_variation_option_name( $name ){
return __( $name, 'my_textdomain' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment