• Resolved korbn

    (@korbn)


    Hello,

    Thanks for this great plugin.

    I would like to use this plugin without having to translate the products. Is it possible to disable somehow the products translation? Or to display all products in the shop page whatever there language ?

    Thanks for taking the time to read this topic and maybe to reply to it!

    Thanks

Viewing 1 replies (of 1 total)
  • Thread Starter korbn

    (@korbn)

    The solution I found is to always display the products of the default language, whatever the current language is. All the products are therefore to be set in the default language.

    add_filter('woocommerce_shortcode_products_query',function($query_args, $atts){
        foreach($query_args['tax_query'] as $key=>$value){
            if($value['taxonomy']=='language'){
                $query_args['tax_query'][$key]['terms'] = DEFAULT_LANGUAGE_ID;
            }
        }
        return $query_args;
    }, 10, 2);

    Of course, you will have to replace DEFAULT_LANGUAGE_ID by your default language id. You can find it in Polylang languages tab (wp-admin/admin.php?page=mlang), by looking the id in the default language edit page (not sure if I am clear enough). This is a number, not a slug (like “en”).

Viewing 1 replies (of 1 total)
  • The topic ‘Disable the products translation’ is closed to new replies.