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 |
---|---|---|---|---|---|---|
- | 8:00 – 15:00 | 8:00 – 15:00 | 8:00 – 15:00 | 8:00 – 15:00 | 8:00 – 15:00 | - |
- | 16:00 – 17:00 | 16:00 – 17:00 | 16:00 – 17:00 | 16:00 – 17:00 | 16:00 – 17:00 | - |
Supporter timezone: Europe/Rome (GMT+02:00)
Tagged: Action needed - Documentation, ATE
This topic contains 17 replies, has 1 voice.
Last updated by Alejandro 1 week, 1 day ago.
Assisted by: Alejandro.
Author | Posts |
---|---|
May 26, 2025 at 10:14 am #17072518 | |
avia-4 |
Background of the issue: Symptoms: Questions: |
May 28, 2025 at 2:18 pm #17084010 | |
Alejandro WPML Supporter since 02/2018
Languages: English (English ) Spanish (Español ) Italian (Italiano ) Timezone: Europe/Rome (GMT+02:00) |
Hello, I have a question for you, in what hook are you linking that code you showed us through a screenshot? the one that contains the save function. I'm asking this because I suspect that if you used the usual WordPress save function, it would probably work, but in here we're talking about WooCommerce which works in a different way. I'll be running a few tests myself to see how we can make this work in the meantime 🙂 Regards, |
May 29, 2025 at 9:15 am #17087194 | |
avia-4 |
This isn't a hook—it's a cron job that I scheduled to run automatically. I'm not entirely sure whether the products are being added to the "Needs Updating" list because of my code. I’ve noticed that even when I update some fields manually, the product doesn't always get translated automatically, but it does get added to the "Needs Updating" list. Do you know if there’s a way to programmatically trigger translation for products already marked as "Needs Updating"? That way, until we understand exactly what causes a product to be added to this list, we can at least ensure they are automatically translated via the hourly cron job, without having to manually send them to translation each time. |
May 29, 2025 at 1:19 pm #17088254 | |
Alejandro WPML Supporter since 02/2018
Languages: English (English ) Spanish (Español ) Italian (Italiano ) Timezone: Europe/Rome (GMT+02:00) |
Hello, I have more info about this. First of all thanks for letting me know this is a cronjob. the products change to "needs updating" because in your code you probably set something. whether it's inventor or anything else, the code likely sends a query requesting and update to the product. Product revisions are difficult to see, they are in the DB like with posts and pages so if a revision was created, then it will change to needs update (This is the easiest way to see it). If you have a product that doesn't have the needs update and then you run the cronjob knowing that product will be modified in any way, that's how you can verify if the needs update is caused by the cronjob. -------------------- We have a hook (action) called: wpml_after_save_post which has 2 parameters: $postId, $callback (optional). Since you're not hooking into anything and it's a WooCommerce save option (not a WordPress save option), then nothing will trigger our automatic translation workflows. A call to the hook after the save line or after you've already made your changes should do the trick here. If you want to know how it's used, you can check .../sitepress-multilingual-cms/classes/automatic-translation/Actions.php What this will do is tell WPML to handle the automatic translation automatically: check for content not in draft that doesn't have a translation or that is set to "needs update" and proceed to translate it. Give it a try and let me know how it goes. |
June 3, 2025 at 1:16 pm #17102494 | |
avia-4 |
thanks for your response |
June 3, 2025 at 3:34 pm #17103178 | |
Alejandro WPML Supporter since 02/2018
Languages: English (English ) Spanish (Español ) Italian (Italiano ) Timezone: Europe/Rome (GMT+02:00) |
Once that status is set, you have to update them, if they were set as "needs update" before, and was never updated from the translation management, then even if you didn't trigger any change, the status would remain. would it be possible to do one simple test: - Add the hook, maybe create a dummy product and a cronjob specifically to update that product. - If the product is indeed updated and translated, then all cool, the hook worked and you'll likely not have issues with the others. if not, then we can continue from there. Would that be possible? |
June 3, 2025 at 7:37 pm #17103963 | |
avia-4 |
i updated in morning all the products, and in the afternoon , i saw again thousand of product in the "need updating list" and any custom cron was running in this time, that why i told you that the problem is not comung from my custom code but somewhere else in wpml plugin. |
June 4, 2025 at 7:01 am #17104727 | |
Alejandro WPML Supporter since 02/2018
Languages: English (English ) Spanish (Español ) Italian (Italiano ) Timezone: Europe/Rome (GMT+02:00) |
Would it be possible to have access to the site, so I can check something and run a few tests? I'm asking because if you "update" a product, then that product is expected to appear as "needs an update" (you updated it after all), So if you did that with all the products, then all of them would appear like that. However, what's not normal is that it doesn't update if you have the automatic translation setup to trigger as soon as there's an update. What I want to test is what happens when I create a product, i then make an update to it MANUALLY (not via custom code, via cron). because the next step, again would be to do what I asked above, to try to update 1 product alone with the cron and see if the problem reappears with that product alone. Would that be possible? Just to be clear here: My colleague ran this test in the chat with you and he mentioned that test returned what we expected, that's why we're certain the problem has to do with your custom code. We also tested this on a clean environment and the problem doesn't happen there, so for now the main suspect here is your custom code executed via that cron. I just want to see if I can find something else that could cause this and see your current setup better as well. |
June 4, 2025 at 2:12 pm #17106984 | |
Alejandro WPML Supporter since 02/2018
Languages: English (English ) Spanish (Español ) Italian (Italiano ) Timezone: Europe/Rome (GMT+02:00) |
Alright, this was my first test: hidden link Quite simple, as you could see. and whenever I made a change to the page, Id see it translated correctly without me doing anything about it. Now, In this video i updated the product you used as a reference but using only the fields that you showed in the screenshot: hidden link the result was the same. For the next step, we need to modify your code to run only for 1 product, not to all the products and see what happens there. I ask you to do that because custom coding is out of the scope of our support so I'm limited on what I can do with it. If possible record yourself while you're doing this and send the video to me later. Regards, |
June 5, 2025 at 6:13 am #17108575 | |
avia-4 |
thank you for your response and expication |
June 5, 2025 at 8:52 am #17109110 | |
Alejandro WPML Supporter since 02/2018
Languages: English (English ) Spanish (Español ) Italian (Italiano ) Timezone: Europe/Rome (GMT+02:00) |
Could you test the same with the user you gave me? because I want to know if the problem could be related to something specific to your user. |
June 5, 2025 at 8:55 am #17109147 | |
Alejandro WPML Supporter since 02/2018
Languages: English (English ) Spanish (Español ) Italian (Italiano ) Timezone: Europe/Rome (GMT+02:00) |
Wait, it seems your user on the video and mine are the same, is that so? because if it doesn't happen to me and it happens to you, then the problem is probably different. could you confirm? |
June 5, 2025 at 9:26 am #17109319 | |
avia-4 |
it,s the same user. |
June 5, 2025 at 11:56 am #17110186 | |
Alejandro WPML Supporter since 02/2018
Languages: English (English ) Spanish (Español ) Italian (Italiano ) Timezone: Europe/Rome (GMT+02:00) |
Yep, on my end, I really have no trouble updating them, i tried it even today without issues and in different ways too, not just in one way. Do you want me to update all the different pages that are like that and maybe record myself while doing it so you can see exactly what I do and see if there's any difference from you? (from your last video, I don't really think so, though). And By any chance, does the same happen to you if: Try to give that a try and see if something changes so we can try to understand why you have issues and I don't (with the same user on the same site!) ------------- |
June 5, 2025 at 3:56 pm #17111194 | |
avia-4 |
hidden link |