Please make sure to update to WPML 4.3.5 and check our list of Known Issues before reporting

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

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 13 replies, has 3 voices.

Last updated by Marcos Vinicios Barreto 2 weeks ago.

Assigned support staff: Marcos Vinicios Barreto.

Author Posts
October 31, 2019 at 8:41 am #4861629

hanne-mariM

I am trying to:
Create products by using the WooCommerce API (the product information comes from an external ERP system with API integration). I'm trying pair translations with the main language. The translations were created at the same time as the main language product by the API.

I expected to see:
Product translations under the main language product.

Instead, I got:
Only the translations are paired together and create a duplicate SKU product, and are not paired with the main language product

November 1, 2019 at 9:22 pm #4873071

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

Thank you for contacting WPML support. I'll be happy to help you with this. Here is a link to our documentation: https://wpml.org/documentation/related-projects/woocommerce-multilingual/using-wordpress-rest-api-woocommerce-multilingual/. You will want to be sure to use the "translation_of" parameter when adding the translated products, as outlined in the documentation.

Please let me know if you need any further assistance and I will be happy to help.

November 4, 2019 at 10:20 am #4879719

hanne-mariM

This is already in order, every translation gets translation_of -value. Is there any way to debug this?

November 4, 2019 at 1:59 pm #4881797

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

Since you are trying to create the translations at the same time as the default language, what are you using for the translation_of? For example, in the documentation, we show this:
'translation_of' => '23'

What are you using for the actual ID? Feel free to paste the full code you are using so we can take a look.

November 7, 2019 at 11:05 am #4905123

hanne-mariM

Here's how it works (pseudo code).

foreach (payload as product) {
    if (sku exists at woo) {
        add woocommerce ID to product
        add update flag to product
    }

    if (update flag is set) {
        remove sku from product data
        remove update flag from product data
        PUT product data to woocommerce
        skip translation handling
    } else {
        POST product data to woocommerce
        get woocommerce ID from response
        if (product has translations) {
            add main product woocommerce ID to translation
            POST translation product to woocommerce
        }
    }
}
November 8, 2019 at 1:58 pm #4913907

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

Please provide the actual code instead of the pseudo code so we can take a look. Thanks.

November 15, 2019 at 9:50 am #4952389

hanne-mariM

The code is written by a 3rd party. I'm not sure if they are willing to share it with us, but I try.

November 15, 2019 at 3:07 pm #4955145

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

Okay great, please let me know when it is available for us to review.

November 20, 2019 at 11:25 am #4979303

hanne-mariM

Hi, can you mark the next answer as private so I can provide the code? 🙂

November 20, 2019 at 4:13 pm #4982085

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

The next reply has been set to private so that you can share the code. Thanks!

November 22, 2019 at 2:50 pm #4999303

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

Thanks for sharing. Our developers took a look at the code and noticed that you are are missing the lang param when posting translation_of https://wpml.org/documentation/related-projects/woocommerce-multilingual/using-wordpress-rest-api-woocommerce-multilingual/#create-products. That needs to be added to the code. You can review the documentation I have linked to see how it should be added.

November 26, 2019 at 12:34 pm #5021429

hanne-mariM

That's not actually true, because the lang-field comes already from the source system. The data looks like this, so the translation_of is filled filled up on the fly. That's why it doesn't show up in the code. So this cannot be the reason.

 'name' => 'Product Title',
        'lang' => 'en',
        'translation_of' => '',
        'description' => '',
        'short_description' => ''
November 26, 2019 at 7:22 pm #5024817

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Bahia (GMT-03:00)

Hello,

Thank you for the updates, I am covering Lauren here, as she is taking some days off. I've forwarded your message for our second level support, I will update you here as soon as I have some more details from them. Thank you for your continued patience and understanding, have a nice day.

November 27, 2019 at 6:22 pm #5031819

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Bahia (GMT-03:00)

Hello,

Thank you for your continued patience while waiting for a solution. According our second level support there's still some missing paramenters for the product translations such as 'type', 'price' and so on as you can read at: https://wpml.org/documentation/related-projects/woocommerce-multilingual/using-wordpress-rest-api-woocommerce-multilingual/#create-products. In any case, we would need to confirm if the same issue is replicable in a clean sandbox environment, for that, please proceed like this:

1 - Access this sandbox environment at: hidden link. It is a one click login url.

2 - Setup it according your website, in your case it would be:

2.1 - WPML Setup at WordPress Dashboard > WPML

2.1 - WooCommerce and WooCommerce Multilingual plugin activation and setup at WordPress Dashboard > Plugins

3 - Try to create your products and products translations in this new environment via REST API.

Please, let me know if you can reproduce the same issue, so we can escalate it properly for our second and third level support or compatibility team. Thank you for your collaboration and continued patience, have a nice day.

The topic ‘[Closed] Pairing problem with WooCommerce products created by the WooCommerce API’ is closed to new replies.