Fix of the week #2 – Multi-language mixed results

#STEP 1 –  The background

A few days ago the FIXMAKERS team was commissioned to check the search function on the website of one of our long-time clients. He’s selling sports equipment and addressing his offer overseas. To do this, he armed his website with multi-language capacity. The benefits of such an extension are countless until you face one annoying issue. It’s when your website shows products in all languages at the same time, causing confusion among your audience. Why should they get foreign results, and be forced to decipher foreign language product descriptions in order to understand them? After all, if this hampers the e-commerce process, the buyers may not give you a second chance. With high probability, they will go to your competitor. Trust me, he already polished this step of his ordering form to a mirror shine.

#STEP 2 – The tech

It brings to the fore the classic example of more actually meaning less. More undesired products, in this case, push aside the products we want to follow and compare. For multi-language support, we picked Polylang – a free alternative to the popular WPML. Plugins like these have to meet a handful of needs. Let’s name a few.

  1. Enable access to new markets
  2. Provide better results in SEO engines
  3. Reach out to the new audience
  4. Sell more     

The choice of the plugin belongs to you. Small websites will benefit from Polylang, while the complex ones may need the versatile but paid WPML. And if you’re the sort of person that loves setup wizard guidance, you’ll definitely be into WPML more. Others who don’t take any form of web aid naturally will, by contrast, appreciate Polylang. Both plugins offer content translation made through the WordPress dashboard. The mechanism is simple – when you view a page in a selected language, all posts written in it are fetched and displayed.

So why does exactly WordPress confuse content?

#STEP 3 – The fix

When your website shows content in two languages, it means that the ‘suppress_filters’ parameter has been set to true. The option applies to the theme or widget that keeps queries for shown posts. In consequence, WordPress skips custom filters that plugins use for them.

The solution is to enable multi-language plugins to have a say in querying for posts. You can do it by editing the PHP file for your theme. Open it and add ‘suppress_filters’ => false. It should look like this:

$args = array(
 'post_type' =>'services',
 'numberposts' => -1,
 'tax_query' => $service_tax_query,
 'suppress_filters' => false
);
$services_posts = get_posts($args);


This will apply to the get_posts function and help show posts only for the language in use.

#STEP 4 – The Clap!

Now the checkout process flows uninterrupted. The visitors get their products in the preferred language. And the average time they spend on the website is improved. Needless to say that the longer the visit lasts, the more user engagement it entails.

Share:

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

4+ years experience in working with global and local partners from the web development industry. He combines strong communication and project management skill-set that helps him develop new opportunities and turn them into long-lasting relationships. Outside front-end and CMS landscape, he writes about film music and performs in improv theatre.

See other articles of Tomasz Ludward