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
13:00 – 17:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 -
- 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: Asia/Jerusalem (GMT+03:00)

This topic contains 18 replies, has 2 voices.

Last updated by Eran Helzer 1 year, 10 months ago.

Assisted by: Eran Helzer.

Author Posts
July 28, 2023 at 5:39 pm #14119275

rainyC

Our website is configured to interact with the ERP system to obtain daily updates on prices and stock availability via an API. I've observed that all the products display the language update icon (attached) despite there being no updates to the content. This situation impacts the publishing settings (ex: when we try to hide out-of-stock products, attached), requiring me to manually click on this icon and save the changes to update the product settings each time.

Could you guide me on how I can activate this icon for all products at once?

PS: Provide WPML Debug info, showing error

Screen Shot 2023-07-28 at 8.38.53 PM.png
Screen Shot 2023-07-28 at 8.28.31 PM.png
Screen Shot 2023-07-28 at 8.27.37 PM.png
July 29, 2023 at 10:29 pm #14121949

rainyC

any uodates?

July 31, 2023 at 8:43 am #14124855

Eran Helzer
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

I apologize for the longer than usual wait.

I may need to consult with the 2nd tier on this issue. Please confirm I understand the situation and the issue:
- You are using the WordPress REST API to update products in the default language
- After you update a products inventory using the REST API, that sets the status of the translation as "Needs updating"
- Which causes issues when you want to hide out-of-stock products

Please answer the following, so I can help you better:
- Is the price/inventory also updated for the product translation?
- Can you share the request you make to update the default language product?

About the debug information, that looks like not the correct information that you need to copy/paste. Please copy the content of the WPML -> Support -> Debug information page, as is described here:
https://wpml.org/faq/provide-debug-information-faster-support/

August 3, 2023 at 7:55 am #14146481

rainyC

- Which causes issues when you want to hide out-of-stock products

The API changing the status to "Needs updating", this first issue
Second, the product settings are not synced between the two languages, for ex, if I keep the product "Privet", the Arabic still shows Public, and I need to change it manually.

- Is the price/inventory also updated for the product translation?
Yes, already it's locked if you open the translated version.

- Can you share the request you make to update the default language product?
hidden link
This one, but I hid the Arabic manually

August 3, 2023 at 11:34 am #14149037

Eran Helzer
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Okay, I understand better now, thank you.

1. This does not happen on a clean install of WPML + WooCommerece. When I change the original product to "Private", even when a translation is in "Needs update", the translation changes to "Private"

2. By the request, I meant the request sent to the WordPress API, not an example of a product, so I can try to reproduce this issue

I tested it again now, and updating a product's price/inventory/visibility, manually, does not necessitate updating the translation, the changes are synced.

In order to be able to consult with the 2nd tier, I need to understand how the products are being updated. If you can, please share the API request being made to update products.

Additionally, I would like to request admin access to your site, in order to take a look.

I have set your next reply to be private so you can share credentials there.
Remember that it is always better to create a new admin user for me, then when we are done you can delete it.

August 5, 2023 at 10:26 am #14158197

rainyC

The code responsible for updating the product is below

data = {
"name": self.name,
"type": self.woo_type,
"regular_price": str(self.list_price),
"stock_status": 'instock' if (self.qty_available > 0 or not self.manage_stock) else 'outofstock',
"stock_quantity": int(self.qty_available),
# "description": '',
# "short_description": self.woo_summary,
'status': 'private',
# "categories": categories,
'attributes': attributes,
# 'variations': variants,
"images": []
}

product_data = wcapi.post("products", data).json()

August 5, 2023 at 11:23 am #14158337

rainyC

* above for product create (Publish from Odoo to Woo)

=============================
Variation Update
=============================

data = {
"regular_price": str(var.lst_price),
"stock_status": 'instock' if (self.qty_available > 0 or not self.manage_stock) else 'outofstock',
"stock_quantity": int(var.qty_available),
"manage_stock": var.manage_stock,
"image": {
},
"attributes": attributes
}
print("product_id", product_id)
var_data = wcapi.post("products/%d/variations" % product_id, data).json()

=============================
Product Update
=============================

to_update_list.append({
'id': var.woo_product_id,
'regular_price': var.lst_price,
'manage_stock': var.manage_stock,
'stock_status': 'instock' if (var.qty_available > 0 or not var.manage_stock) else 'outofstock',
'stock_quantity': var.qty_available,
# 'attributes': attributes
})
data = {
"update": to_update_list
}

updated_products_var = wcapi.post("products/%d/variations/batch" % product_id.woo_product_id, data).json()

August 6, 2023 at 12:33 pm #14159911

Eran Helzer
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Thank you for the additional information.

Since this is custom code, it is outside of our support policy, thus we won't take any responsibility for it. I will try my best to help you find a solution, but please keep that in mind.

First, I would like to ask this. Is there any difference, regarding your issue, between updating a variant and a product?

I will also need a few examples of the unsynched products, so I can see how they behave differently. Can you please send me a few links of such products?

Regarding how WPML detects what products need updating, I am not sure exactly. I have asked the 2nd tier and will get back to you on that.

August 7, 2023 at 7:50 am #14161645

rainyC

* The code was sent based on your request.

First, I would like to ask this. Is there any difference, regarding your issue, between updating a variant and a product?

my issue is "Need updating" icon

I will also need a few examples of the unsynched products, so I can see how they behave differently. Can you please send me a few links to such products?

Check any product with "Need updating" icon, change for ex status from Public to Privet, and see if the Arabic version became Privet too.

August 7, 2023 at 11:55 am #14163445

Eran Helzer
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Of course, I asked for the code so I could help you better. I was simply explaining our support policy, so you were aware.

I checked out one product that was in "Needs updating" and saw the unsynched visibility issue.
However, even after finishing the translation the visibility did not sync.
hidden link
It does sync, but only after sending the product to translation, which is not the normal behavior.

This means that something else is conflicting with WPML and causing this, as on a clean site with WooCommerce this does not happen.

In order to confirm this, we will need to perform a minimal test. For the we need to:
- Deactivate all non WPML/WooCommerce plugins
- Switch to a WordPress default theme

If possible, it is much preferable to do this on a staging site where the issue is replicated.
If you don't have one, I can provide an alternative.

Please update me on how you prefer to proceed.

August 7, 2023 at 2:45 pm #14164651

rainyC

Please make the message private

August 8, 2023 at 12:44 pm #14169357

Eran Helzer
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Update.

It looks like the status is not changing in the backend, but on the frontend it is working as expected. When a product is set to "Private", the Arabic does not synchronize but it is not available to not logged-in users on the frontend.

This is caused due to the object caching you have enabled. The solution, which I tested on the staging site, is to add the following lines to your wp-config.php file:

define('WP_REDIS_CONFIG', [
    'non_persistent_groups' => [
    'counts',
    'plugins',
    'themes',
    'bp_pages'
]
]);

https://wpml.org/errata/problems-with-buddypress-multilingual-and-redis-object-cache/

Please update me on if this resolves your issue.

August 8, 2023 at 2:53 pm #14170239

rainyC

The code has been successfully updated.
Please check

August 8, 2023 at 4:31 pm #14171231

Eran Helzer
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

It seems not be working.

It appears also that the staging site simply did not have object cache enabled, that's why on the staging site it worked.

We need to make sure that the excluded groups are correct in the configuration we added ("non_persistent_groups").
Can you explain to me how the object cache is setup on your site?

I will also consult again with the 2nd tier if we are missing something.

August 15, 2023 at 7:54 am #14201565

rainyC

Hi Eran, do you have any update?

The topic ‘[Closed] Language update’ is closed to new replies.