Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 12:00 – 14:00 12:00 – 14:00 12:00 – 14:00 12:00 – 14:00 12:00 – 14:00 -
- 17:00 – 21:00 17:00 – 21:00 17:00 – 21:00 17:00 – 21:00 17:00 – 21:00 -

Supporter timezone: Europe/Vienna (GMT+02:00)

This topic contains 17 replies, has 0 voices.

Last updated by edmondC-2 7 hours, 30 minutes ago.

Assisted by: Bigul.

Author Posts
May 21, 2025 at 8:00 am #17055472

edmondC-2

问题的背景:
I am trying to make the product ranking on the English page consistent with the product ranking on the Chinese page for my site hidden link.

症状
Inconsistent sorting between Chinese and English on the product page.

问题
How to make the product ranking on the English page consistent with the product ranking on the Chinese page?

May 21, 2025 at 3:00 pm #17058196

Bigul
WPML Supporter since 01/2013

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

Maybe you are facing this issue because of compatibility conflicts. To confirm, please follow the steps below on your staging (test) site, if possible, and let us know your feedback.

a) Backup your staging (test) first[Mandatory]
b) Switch for a moment to a WordPress default theme like 2025
c) Deactivate all the plugins that are not related to WPML, except Elementor and WooCommerce
d) Then check whether the issue exists or not
e) If the issue is gone, activate the plugins as a group of three or four to find which one has an interaction issue
f) Switch back to the original theme of the site

--
Thanks!

Bigul

May 22, 2025 at 2:13 am #17059366

edmondC-2

I copied a backup website, can you help me debug and identify the problem

May 22, 2025 at 8:51 am #17060290

Bigul
WPML Supporter since 01/2013

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

Thank you for the updates. I am enabling the private option for the next reply. Please share the staging site credentials.

Also, allow us to make a copy of the site using the Duplicator plugin (https://wordpress.org/plugins/duplicator/), in case of further debugging and escalation.

--
Thanks!

Bigul

May 22, 2025 at 4:56 pm #17063012

Bigul
WPML Supporter since 01/2013

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

Thank you for the credentials. I was able to access the staging site backend and performed a few rounds of testing in a minimal setup (Elementor, WooCommerce and WPML plugins are only active).

I have one question. Please check the attached images. The products are loading in a different order than the latest created order.

So, please visit the Shop page on the staging site (hidden link) and confirm whether it is showing the expected results in Chinese under the minimal setup.

--
Thanks!

Bigul

Screenshot 2025-05-22 at 9.46.56 PM.png
Image 22-05-25 at 9.53 PM.jpg
May 23, 2025 at 1:31 am #17063897

edmondC-2

Yes, I saw it. It should be products added at the same time because they are ranked first by the latest product. It may be due to the first sorting being (date) and the second sorting being (name). I only have the sorting switch option in the Mentor editor and there are no other sorting rules, or you can see if there are any methods to make their sorting consistent. Thank you

4.png
May 23, 2025 at 9:35 am #17065165

Bigul
WPML Supporter since 01/2013

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

Thank you for the updates. To make sure, have you selected the *Sort by most recent* option in Appearance >> Customize >> WooCommerce >> Product Catalog >> Default product sorting? Please check the attached image for more details.

--
Thanks!

Bigul

2025-05-23_14h59_42.png
May 23, 2025 at 9:57 am #17065355

edmondC-2

Yes, the selection is based on recent additions

5.png
May 26, 2025 at 7:00 am #17071061

Bigul
WPML Supporter since 01/2013

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

Thank you for the updates. I have shared the details with our team for an expert opinion. We will get back to you as early as possible. Please wait.

--
Thanks!

Bigul

May 29, 2025 at 11:01 am #17087662

Bigul
WPML Supporter since 01/2013

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

We are still working on this bug. The ticket has been escalated to our second-tier team for further investigation. We will get back to you as soon as possible. Please wait.

--
Thanks!

Bigul

June 4, 2025 at 7:08 pm #17107961

Bigul
WPML Supporter since 01/2013

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

We are still working on this ticket and have observed that the shop page shows products with the same publish date when viewed in each language. However, the order of these products may differ between English and Chinese. WordPress doesn't apply a secondary sorting rule when multiple products share the same publish date.

To ensure consistent product order across languages, we must define a secondary sorting condition, like sorting by price, SKU, or another field. Sorting by title may not work well due to language differences. If your preferred sorting option is not available through the UI, we can add a small custom code snippet to apply it. Please let us know your preferred secondary sort method so we can guide you accordingly.

--
Thanks!

Bigul

June 6, 2025 at 1:45 am #17112744

edmondC-2

The preferred secondary sorting method uses SKU because this field is consistent in both Chinese and English

June 6, 2025 at 8:26 am #17113196

Bigul
WPML Supporter since 01/2013

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

Thank you for the updates. I will consult with our team and get back to you as soon as possible. Please wait.

--
Thanks!

Bigul

June 11, 2025 at 4:42 pm #17127315

Bigul
WPML Supporter since 01/2013

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

We are getting the expected results on your staging site after adding the following snippet to the theme’s functions.php file. This code sorts the products first by date and then by SKU.

Please check the results and let us know your feedback. Refer to the attached images for more details.

add_action('pre_get_posts', 'custom_modify_shop_query', PHP_INT_MAX); 
function custom_modify_shop_query($query) {
    // Only modify the shop order if an order has not been specified
    if ( !isset($_GET['orderby']) && !is_admin() && $query->is_main_query() && is_shop()) {

        // Set meta_key so SKU ordering works
        $query->set('meta_key', '_sku');

        // Set orderby to array: first by date, then by SKU
        $query->set('orderby', array(
            'date'       => 'DESC',
            'meta_value' => 'ASC',
        ));
    }
}

--
Thanks!

Bigul

2025-06-11_22h06_48.png
2025-06-11_22h06_18.png
2025-06-11_22h05_59.png
June 12, 2025 at 2:21 am #17128158

edmondC-2

Hello, the sorting of the product homepage is consistent, but when selecting a category to view the products, it is still inconsistent. Could you please solve this problem as well,

2.png
1.png