• HI,
    Using latest Woocomm & WordPress, and besides some other issues I have encountered I also see that the product name in cart (woocommerce) does not get translated ….

    How can I achieve that?

    This code you proposed earlier in an older post, does not work ??

    add_filter('woocommerce_cart_item_product', function($product) {
      $product->post->post_title = apply_filters('sublanguage_translate_post_field', $product->post->post_title, $product->post, 'post_title');
      return $product;
    });

    Any ideas?

    Thanks

Viewing 1 replies (of 1 total)
  • Sorry this snippet doesn’t work anymore since Woocommerce 3.x. Please use this instead:

    
    add_filter('woocommerce_product_get_name', function($name, $product) {
      $post = get_post($product->get_id());
      if ($post) {
        return apply_filters('sublanguage_translate_post_field', $name, $post, 'post_title');
      }
      return $name;
    }, 10, 2);
    
Viewing 1 replies (of 1 total)
  • The topic ‘Product name in cart not getting translated’ is closed to new replies.