Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is experiencing issues with custom fields not transferring correctly for variation products in a translating plugin and CDX feed plugin for Google Shopping, affecting pricing measures.
Solution:
If you're encountering similar issues, we recommend navigating to WPML -> Settings -> Custom Field Translation and setting those fields to 'Copy' as required. This process is detailed in our documentation, which you can find here: Translating Custom Fields.
If you don't see those custom fields, try clicking 'Show System Fields' below the 'Custom Field Translation' heading. Then, search for 'Unit Price Measure' and 'GTIN' to ensure they are set to copy.
Please remember to backup your database before making these changes.

This solution might be irrelevant if it's outdated or not applicable to your specific case. We highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the issue persists, please open a new support ticket at WPML support forum.

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.

This topic contains 15 replies, has 2 voices.

Last updated by Andrey 2 months, 2 weeks ago.

Assisted by: Andrey.

Author Posts
September 16, 2024 at 4:52 pm #16185034

ylyasK

Background of the issue:
Hi there! In this video,

hidden link

I discuss a problem I encountered with translating plugin and CDX feed plugin for Google Shopping. I explain how custom fields are not transferring for variation products, causing issues with pricing measures. I seek help on how to ensure these values are copied correctly for each variation.

Symptoms:

Questions:

September 16, 2024 at 6:02 pm #16185250

Andrey
Supporter

Languages: English (English ) Russian (Русский )

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

Thank you for contacting WPML support.

Have you tried navigating to WPML -> Settings -> Custom Field Translation and setting those fields to Copy as required? This is explained in the document at https://wpml.org/documentation/getting-started-guide/translating-custom-fields/.

If you don't see those custom fields, try clicking "Show System Fields" below the "Custom Field Translation" heading. Then, search for Unit Price Measure, Unit Price Measure, and GTIN to see if you find those fields.

Please remember to backup your database before you proceed.

September 17, 2024 at 7:44 am #16186441

ylyasK

Thank you

Now I did set those to "Copy"

hidden link

It didn't help

then I also set

woo_feed_unit_pricing_base_measure_var
woo_feed_unit_pricing_measure_var

parameters to Copy

hidden link

Still nothing

I tried to Purge all cache in my caching plugin as well, but still nothing

but I find it interesting that previously set GTIN from Rank Math is being copied for variations but those parameters (unit measures) don't

may be it is because of I have to purge some WPML own cache in its settings I don't know

September 17, 2024 at 8:04 am #16186721

Andrey
Supporter

Languages: English (English ) Russian (Русский )

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

Thank you for your feedback.

Have you tried testing with a new product? Or did you modify the original product, save it, and navigate to the WPML translation editor to complete the translation?

If the issue persists, please try replicating it on the test installation I created. The link is in the private reply below.

September 17, 2024 at 10:22 am #16187622

ylyasK

Now I did modify the original product, saved it. (I didn't check the box Minor changes, no need to edit translations. So I had to resave all six translations). And it helped. Now there are values

But I have over 290 products. It is very tedious to resave them all especially with their translations it will take a very long time. Is there faster way to do it?

September 17, 2024 at 1:44 pm #16188964

Andrey
Supporter

Languages: English (English ) Russian (Русский )

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

I'm relieved to hear that it's working now.

Unfortunately, no settings in WPML can help you achieve this. One option is to try updating the products in bulk mode by going to Products → All products, selecting at least a few products, and choosing Edit from the Bulk actions dropdown option. Choose the language before, if needed. This might resolve the issue.

Another approach is to address this programmatically, but please note that this is beyond the scope of our support. You can find more on this idea here: https://wpml.org/forums/topic/how-to-mass-update-post-translation-statuses/#post-15259714. However, you will need to make all the adjustments and coding yourself.

If none of these methods work, then it may be necessary to update the products manually.

September 17, 2024 at 2:04 pm #16189069

ylyasK

In case with codes

do I just create code snippet in code snippets plugin and paste that code, save it, and update my page, purge cache and remove the snippet?

(Of course backing up my site beforehand)

September 17, 2024 at 2:09 pm #16189109

Andrey
Supporter

Languages: English (English ) Russian (Русский )

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

You need to insert a code into your current theme's functions.php file, make necessary adjustments to it to work with the products, execute the code by refreshing the admin page, and then remove it.

September 17, 2024 at 2:16 pm #16189192

ylyasK

Is this correct adjustment for this code to work with products:

// Add a function to the admin_init hook
add_action( 'admin_init', 'save_all_posts_on_refresh' );

// Define the function to save all posts on refresh
function save_all_posts_on_refresh() {
// Check if the current page is the posts page
global $pagenow;
if ( $pagenow == 'edit.php' ) {
// Get all the posts
$args = array(
'post_type' => array('product'),
'numberposts' => -1
);
$all_posts = get_posts( $args );
// Loop through all the posts and update them
foreach ( $all_posts as $single_post ) {
wp_update_post( $single_post );
}
}
}

I now I might sound annoying, but I really need to solve it, I hope you understand me, thanks

September 17, 2024 at 2:17 pm #16189197

Andrey
Supporter

Languages: English (English ) Russian (Русский )

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

It looks like yes, but I cannot be 100% sure as this needs to be tested. I hope this helps. Don't forget about the backups.

September 17, 2024 at 2:38 pm #16189273

ylyasK

It didn't help with variations, those values are still empty on variations(

September 17, 2024 at 6:51 pm #16190338

Andrey
Supporter

Languages: English (English ) Russian (Русский )

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

I'm sorry to hear this 🙁 Some additional code may need to be added to handle a variation product.

I would suggest trying the first option. You can try to select 20, 30, etc. products at once and update them in bulk.

September 18, 2024 at 8:42 am #16191741

ylyasK

This method didn't help as well(

I tried several times on different languages with cache purging, still nothing

September 18, 2024 at 8:57 am #16191804

Andrey
Supporter

Languages: English (English ) Russian (Русский )

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

I'm sorry, but I don't have any other suggestions besides updating the products manually.

September 18, 2024 at 8:59 am #16191808

ylyasK

Got it. Thanks a lot. Have a great day