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.

This topic contains 24 replies, has 3 voices.

Last updated by carmenV-7 3 years, 6 months ago.

Assisted by: Andreas W..

Author Posts
September 11, 2020 at 10:28 pm #6997069

dimitrisB-3

I am trying to sync the catalog. Because of two languages, products sync on both languages and appear as duplicate. Also, the links of secondary language (Greek) in feeds point to the original language and not on translation links.

Finally, the shop on Facebook displays duplicate products because of the above.

How can links and duplicate products be fixed?

Regards

Screenshot 2020-09-12 at 1.27.29 AM.png
September 13, 2020 at 2:25 am #7000963

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

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

Hello,

Please update our plugins to the latest version at:

Plugins -> Add new -> Commercial -> Search for updates

If the issue persists, please verify the Option WPML -> Languages -> Facebook Visibility and set it accordingly.

If this will still not solve the issue we might need to take further steps.

Kind regards
Andreas

Capture.PNG
September 13, 2020 at 10:25 am #7002317

dimitrisB-3

I have the latest plugins versions and Visibility is already set accordingly.

The problem is that the translated pages (Greek) have different product ids in feeds when the translations should have the same product ids in Greek feeds with English feeds and set an override attribute with language ISO code in, so Facebook could recognize them as a translation of English feed and not as separate products.

Also, the links in the translated feeds should point in translated pages /?lang=el when they not.

September 13, 2020 at 11:09 am #7002403

dimitrisB-3

I am uploading and a screen capture of the duplicate catalog. The English product in the catalog has no language override while the Greek product as you can see and in the video has also a Greek language override for the Greek product?!?!

hidden link

September 15, 2020 at 7:51 pm #7021075

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

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

Hello,

It might be that this behavior is expected for admin users, but does it behave the same for Facebook visitors?

Please also test setting the site URL format to "Language in directories" at WPML -> Languages instead of using "Language as Parameters".

Apart from that please enable the WPML language cookie for supporting AJAX filtering at WPML -> Languages.

More details here:
https://wpml.org/documentation/getting-started-guide/language-setup/enabling-language-cookie-to-support-ajax-filtering/

If this will not solve the issue I can offer to create a app on our test server on Cloudways and we could migrate a copy of your website for further investigation.

Kind regards
Andreas

September 16, 2020 at 5:12 pm #7030003

dimitrisB-3

It might be that this behavior is expected for admin users, but does it behave the same for Facebook visitors?

Tried with a guest to my client's Facebook page shop and it sees both products. So no it does not happen only to admins.

Regarding the AJAX cookie, it is already enabled.

Now about URL format what you ask is not possible to make as a change on a live site since it will seriously impact SEO and Google ranking and it risks breaking something on the eshop.

I tried though the changes in a staging site and Facebook for Woocommerce Plugin still creates the products with only default language URLs in both languages. Please find the generated CSV here: hidden link

Also, the same product between 2 languages has different product ids, as you can see in the attached generated CSV when it should have the same id in both languages and an override attribute with the translation language ISO code, so Facebook catalog can understand this as translation content and not as a second product. As per Facebook guidelines: hidden link

September 16, 2020 at 6:38 pm #7030345

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

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

Hello,

Thank you for the provided information.

Please add the following code snippet to your theme´s functions.php file:

 add_filter ('facebook_for_woocommerce_integration_prepare_product', 'fix_product_url', 11, 2);

 function fix_product_url($product_data, $id) {
	 $product_lang = apply_filters( 'wpml_post_language_details', null, $id );
	 $product_data['url'] = apply_filters( 'wpml_permalink', $product_data['url'], $product_lang['language_code'] );
	 return $product_data;
 }

Then sync again with the Facebook page: WooCommerce->Settings->Integration -> Sync-ReSync.

Does this solve the issue?

Kind regards
Andreas

September 17, 2020 at 2:40 pm #7037917

dimitrisB-3

While it has fixed products links your solution, it hasn't fixed the checkout links in CSV.
Also, still, two languages appear as 2 separate products, since product ids are different, and not as a translation of the main product...

Screenshot 2020-09-17 at 5.33.56 PM.png
Screenshot 2020-09-17 at 5.34.01 PM.png
Screenshot 2020-09-17 at 5.40.10 PM.png
Screenshot 2020-09-17 at 5.31.59 PM.png
September 17, 2020 at 7:51 pm #7040377

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

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

Hello,

Could you please provide me more information about the issue?

Here is how WPML handles the products and their Post ID in WordPress and the SKU:

1) We create a product with SKU 0001 and WordPress gives it a Post ID, example post_id_28

2) We translate the product which will use the same SKU 0001 and new Post ID, example post_id_29

Now, if the Facebook for WooCommerce uses own Product IDs for their user interface then ther eis nothing WPML could do about this from our side.

I have created here a test-site for you to investigate and if needed recreate the issue, but if those IDs are generated by the Facebook plugin, then you should consult their support team about the issue.

One-Click-Login:
hidden link

Kind regards
Andreas

September 18, 2020 at 11:57 am #7045293

dimitrisB-3

Facebook plugin creates the product id from combining SKU+Post ID. For example for same product in 2 languages:
PRD-01/022/0051_8791
PRD-01/022/0051_8792

So from what you say I cannot bypass the duplicate products in feeds. This is unfortunate but I understand this is not something WPML can control.

One last question can you give me and relevant PHP code to fix add to cart links?

Also for your reference here you can find generated feeds: hidden link

Can I propose as a feature to implement in the next versions fix for translation links?

September 18, 2020 at 6:47 pm #7048379

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

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

Hello,

Thank you for your message.

For understanding the issue in the right context:

If a client clicks on a Product on Facebook he is always getting redirected to the English Checkout Page instead of the Greek version for Greek products?

If so, I see you are using the language as parameter setting for the URL. Could you please test if it works if you enable "Languages in Dorectories" instead at WPML -> Languages?

Also, please verify if language redirection by browser language is enabled and test with or without this setting.

Let me know the results.

Kind regards
Andreas

September 18, 2020 at 7:16 pm #7048467

dimitrisB-3

Facebook Plugin creates in feed, except for product links, and add to cart links. The add to cart links are also in the one language in both product languages in the feed. If you open the CSV feed I sent you above you will see the add to cart links in CSV. Is there a way to fix this with PHP code in functions.php?

September 19, 2020 at 1:15 am #7049067

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

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

Hello,

I am sorry but you did not answer my question.

If a client clicks on a Product on Facebook he is always getting redirected to the English Checkout Page instead of the Greek version for Greek products?

Is the issue with the cart URLs inside the CSV export file connected to functional issues with WPML?

You are referring with the CSV feed to a Facebook Feature as this:

If a client clicks on a Product on Facebook he is always getting redirected to the English Checkout Page instead of the Greek version for Greek products?

Please take note, that if we handle a Facebook internal feature, then we might not be able to take any influence on this from our side. Further, custom code solutions are not covered by our support policy.

https://wpml.org/purchase/support-policy/

How do you export this feed? Does it come from the options inside of WoooCommerce -> Facebook?

If need I will setup a Facebook account for testing pupose, but I need to know in detail how to recreate the issue and see if we can fix it with adjusting settings or translations.

Kind regards
Andreas

September 23, 2020 at 8:27 am #7077339

dimitrisB-3

Hi!

If a client clicks on a Product on Facebook he is always getting redirected to the English Checkout Page instead of the Greek version for Greek products?"

That is correct. As for example with this Greek product, if you click checkout you are sent to the English cart page of the e-shop.
hidden link

How do you export this feed? Does it come from the options inside of WoooCommerce -> Facebook?

The feed is generated by the Facebook for Woocommerce plugin. It is some sort of incompatibility between the plugin and WPML I suppose since it is not adding the correct links for translated pages, in order to include them in the feed. I access the feed either through Facebook Business Manager or through FTP access to the e-shop in the UPLOADS folder.

Hope that answers your questions

September 23, 2020 at 8:51 pm #7084077

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

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

Hello,

Thank you for your message.

In order to confirm and further escalate the issue could you please assist me in setting up this test-page?

One-Click-Login:
hidden link

We will take further steps from there. Please send me a short notification once WooCommerce and Facebook are set up and I will do the testing and further escalation.

In case you are not able to recreate the issue on this new WordPress install, then the problem might be connected to a third plugin in use.

Did you already test if the issue persists while using only WPML, WooCommerce and Facebook for WooCommerce?

Kind regards
Andreas

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.