Support » Plugin: WP Multilang » Woocommerce Product attribute is not translating.

  • Resolved hsupyaenaung

    (@hsupyaenaung)


    If you add a product with certain attribute, they are not translating at all.

    It shows like : Product Title – [:en]36″ x 24″[:my]၃၆” x ၂၄”[:]

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 15 total)
  • Thread Starter hsupyaenaung

    (@hsupyaenaung)

    Found the solution myself. Had to update custom product attribute under taxonimies at wpm-config.json.

    Like so:

        "taxonomies": {
            "yada": {},
            "yadayada": {},
            "yadayadayada": {},
            "yadayadayadayada": {},
            "yadayadayada": {},
            "pa_size": {}
        },
    • This reply was modified 3 years, 6 months ago by hsupyaenaung.
    Thread Starter hsupyaenaung

    (@hsupyaenaung)

    Sadly, this conflict with woocommerce plugin and the variation dropdown becomes empty. Any thoughts?

    Thank you @hsupyaenaung
    This help me very much

    Thread Starter hsupyaenaung

    (@hsupyaenaung)

    Hey @shostakmaksim

    I’m glad it helped. Does it conflict with woocommerce variation dropdown (single page) for your theme as well?

    @hsupyaenaung

    I made something like this

    add_filter('wpm_taxonomies_config', function ($taxonomies_config) {
    // this part to enable render filters on shop/category/tag
        if (is_admin() || is_cart() || is_checkout()) {
            $taxonomies_config['pa_brend'] = [];
            $taxonomies_config['pa_material'] = [];
            $taxonomies_config['pa_navantajennya'] = [];
            $taxonomies_config['pa_uknapovnyuvach'] = [];
            $taxonomies_config['pa_uktyp-matraczu'] = [];
            $taxonomies_config['pa_ukvysota'] = [];
        }
        // some add to cart decoration
        if (is_product() && $_SERVER['REQUEST_METHOD'] === 'POST') {
            $taxonomies_config['pa_brend'] = [];
            $taxonomies_config['pa_material'] = [];
            $taxonomies_config['pa_navantajennya'] = [];
            $taxonomies_config['pa_uknapovnyuvach'] = [];
            $taxonomies_config['pa_uktyp-matraczu'] = [];
            $taxonomies_config['pa_ukvysota'] = [];
        }
        return $taxonomies_config;
    }, 10);

    With this snippet I do the maximum
    And I filter $product->get_name this way to fix variation translation on cart/checkout

    add_filter('woocommerce_product_variation_get_name', function($value, $entity){
        return $entity->get_title();
    },10,2);
    • This reply was modified 3 years, 5 months ago by Max Shostak.

    @shostakmaksim Thank You !

    Thread Starter hsupyaenaung

    (@hsupyaenaung)

    @shostakmaksim

    Oh my~! It starts to work like a charm when both of our codes are combined.

    Thanks man~ I feel so blessed. 🙂

    @hsupyaenaung hi! could you please take look at my variant, because it doesn’t working:
    add “pa_volume” in /plugins/wp-multilang/core-config.json:

      "taxonomies": {
        "category" : {},
        "pa_volume" : {},
        "post_tag" : {}
      },

    and get a conflict with woocommerce variation dropdown.

    so i add this code in functions.php of my theme:

    add_filter('wpm_taxonomies_config', function ($taxonomies_config) {
    // this part to enable render filters on shop/category/tag
        if (is_admin() || is_cart() || is_checkout()) {
            $taxonomies_config['pa_volume'] = [];
        }
        // some add to cart decoration
        if (is_product() && $_SERVER['REQUEST_METHOD'] === 'POST') {
            $taxonomies_config['pa_volume'] = [];
        }
        return $taxonomies_config;
    }, 10);
    
    add_filter('woocommerce_product_variation_get_name', function($value, $entity){
        return $entity->get_title();
    },10,2);

    as the result the dropdown still doesnt working plus translate issue in the cart isnt fixed at all :))
    Whats wrong?

    Thread Starter hsupyaenaung

    (@hsupyaenaung)

    Hey @ipapilina,

    I also had the same issue as you even after I added the second code you described at the functions.php. Then I found out you have to play around with some setting at your product post. In the end, I didn’t add any code for my functions.php for it.

    If I remembered correctly, it solution lies within Attributes / Variations tabs under “Product data” panel.

    Here are my settings for Attributes:
    [ ] Visible on the product page
    [x] Used for variations

    And for the Variations:
    [x] Enabled: [ ] Downloadable: [ ] Virtual: [ ] Manage stock?

    Let me know if it turns out well for you.

    HPN

    Hi @hsupyaenaung ,
    thank you for your tips, i tried to install thi settings in the Product Panel, but nothing 🙁 The variation dropdown still doesn’t working. Its really sad.. I love the WP Multilang plugin, but this problem kills all profit!

    Thread Starter hsupyaenaung

    (@hsupyaenaung)

    Hi @ipapilina,

    As I read your first statement carefully, I see that you had introduced the new taxonomy pa_volume in /plugins/wp-multilang/core-config.json.

    Try moving it into a separate file with name wpm-config.json inside your theme folder?

    Example:
    wp-content/themes/yourtheme/wpm-config.json

    The plugin will auto-detect that file.

    As for me, I like to put it in some sub dir with custom name so I am using the filter as follows:

    add_filter('wpm_json_files', function ($config_files){
    	$config_files[] = get_template_directory() . '/custom_directory/custom_wpm-config.json';
    	return $config_files;
    });

    Also, remove this code:

    add_filter('wpm_taxonomies_config', function ($taxonomies_config) {
    // this part to enable render filters on shop/category/tag
        if (is_admin() || is_cart() || is_checkout()) {
            $taxonomies_config['pa_volume'] = [];
        }
        // some add to cart decoration
        if (is_product() && $_SERVER['REQUEST_METHOD'] === 'POST') {
            $taxonomies_config['pa_volume'] = [];
        }
        return $taxonomies_config;
    }, 10);
    
    add_filter('woocommerce_product_variation_get_name', function($value, $entity){
        return $entity->get_title();
    },10,2);

    I am only introducing new taxonomy to .json file to translate that part.

    Make sure you have added new Product Attribute and have it translated at Attributes panel.

    For your case the attribute slug should be named “volume” only. Then, select that attribute when you create variable product, and try following up the setting as I have stated previously?

    [ ] Visible on the product page
    [x] Used for variations
    
    And for the Variations:
    [x] Enabled: [ ] Downloadable: [ ] Virtual: [ ] Manage stock?
    • This reply was modified 3 years, 3 months ago by hsupyaenaung.
    • This reply was modified 3 years, 3 months ago by hsupyaenaung.

    Hey ya! Thanx a lot for your response, feel not so along with my problem.
    Look its doesnt working:

    add a file wp-content/themes/yourtheme/wpm-config.json with

    "taxonomies": {
        "pa_volume" : {},
      },

    and its work! (because the variant in the cart is perfectly translated)

    BUT! on the product page variants are disappeared..
    i checked the attribute/variant settings on the product page builder, all are like you told:

     [ ] Visible on the product page
    [x] Used for variations
    
    And for the Variations:
    [x] Enabled: [ ] Downloadable: [ ] Virtual: [ ] Manage stock?

    Any ideas?

    @hsupyaenaung
    @chuonggio171
    @shostakmaksim

    wow! this works perfectly for me!
    https://github.com/VaLeXaR/wp-multilang/issues/156#issuecomment-656823063

    Only one thing – i cant to transfer this plugins file to the child theme.

    Thread Starter hsupyaenaung

    (@hsupyaenaung)

    Hi @ipapilina

    After many months, I had encounter same issue lately and realised it has to do with your variation order. If it was not set to order by name, it will disappear. Mine was set to custom order, thus it disappeared.

    So, if you still want the attribute list to be translated and have a custom order,
    here is what you can do:

    You have to choose order by name and then, reorder them by using Css.

    Example : Wrapper -> display: flex; List -> order: 1, 2, 3, 4 and so on.

    This is only the perfect fix I find so far. I hope the plugin author would to address issue in future.. anytime soon.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Woocommerce Product attribute is not translating.’ is closed to new replies.