1

Is it possible to translate custom product attributes using Polylang Pro?

I don't see anywhere the option to translate a custom product attribute.

enter image description here

Chris
  • 31
  • 4

1 Answers1

0

The answer came from the Polylang! I need to unsychronize the Custom Product Attributes.

The developper need to use the pllwc_copy_post_metas filter. It will allow you to uncopied and unsynchronized the product_attribute and attribute metas. Be careful because these 2 metas included custom and global attributes. That's mean the developper must target only the custom attributes inside this filter (that's required to get a fair knownledge of WooCommerce).

The pllwc_copy_post_metas filter is documented in polylang-wc/include/product-language-cpt.php

The developper may need to unhook the 3 actions in polylang-wc/products.php at line 30-33 to allow you to have global attributes in one language and custom product attributes in another.

add_filter("pllwc_copy_post_metas", function($to_copy, $sync, $from, $to, $lang){
    unset($to_copy['my_custom_product_attribute_name']);
    return $to_copy;
}, 1, 5); 
Chris
  • 31
  • 4