• Hey,

    I have an issue with translations of the attributes.
    They are translated in backend as seen here: https://prnt.sc/w0u8yKO3ABbd

    But when I pull attributes via code, it does not pull translation, always default language:

    <?php global $product;
    
    	$attributes = $product->get_attributes();
    
    	if( $attributes ) : ?>
    
    		<div class="fl-atts">
    
    			<h2 class="fl-eq-title"><?php echo __( 'Technical data', 'shoptimizer' ) ?></h2>
    
    			<?php foreach ( $attributes as $attribute ) :
    
        // skip variations
        if ( $attribute->get_variation() ) {
        continue;
        }
            $name = $attribute->get_name();
    	$value_string = implode( ', ', $attribute->get_options() );
           
     ?>
    
    					<div class="fl-att">
    
    						<div class="fl-att-label"><?php _e($name, 'woocommerce') ?></div>
    						<div class="fl-att-value"><?php _e($value_string, 'woocommerce') ?></div>
    						
    					</div><?php 
    
    			endforeach; endif; ?>

    I guess this part does not pull the translations, but the question is why?
    _e($name, ‘woocommerce’)

Viewing 1 replies (of 1 total)
  • Plugin Support Andrés Cifuentes

    (@andrescifuentesr)

    Hello @krdza93,

    Your code seems fine, I would recommend you to check if you are receiving the $product in the right language, for example, with a hook like this.

    However we can’t provide you support in this forum as this is a WPML related question and there is a no commercial support policy allowed here on WordPress forums.

    As you are using WPML, please go to our support forum and open a chat there, we have all the required tools to assist you and we will be happy to help you to solve this issue quickly.

    Thank you for your understanding.
    Andrés

Viewing 1 replies (of 1 total)
  • The topic ‘Not translating woocommerce attributes’ is closed to new replies.