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 6 replies, has 2 voices.

Last updated by Itamar 7 months, 3 weeks ago.

Assigned support staff: Itamar.

Author Posts
February 8, 2019 at 11:16 am #3174766

vittorioS-2

Hi,
I am trying to hiding product from frontend but, if woocommerce-multilingual is active, they not work properly.

I have active ONLY wpml plugins in default theme

WooCommerce Multilingual
WPML Multilingual CMS
WPML String Translation
WPML Translation Management

If deactivate WooCommerce Multilingual, the product visibility work properly.

Can i solve it?

Thanks,
Vittorio Schiavone

February 10, 2019 at 4:31 pm #3179973

Itamar
Supporter

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

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

Hi, Vittorio.

We already have similar reports about this issue, but I'm trying to understand exactly how to replicate this issue.
Could you please tell me the exact steps of how I can replicate this issue?
Are you setting the 'Visibility -> Private'?
Or 'Catalog visibility -> Hidden'?
Please see the attached screenshot.

Thanks,
Itamar.

February 11, 2019 at 2:10 am #3180399

vittorioS-2

I use "Catalog visibility -> Hidden" and, after send form update, the voice don't change.
For example:
i have a product setted as "Shop and search results", if change to "Hidden" and send form, it remain on "Shop and search results".

If disable "WooCommerce Multilingual" plugin and execute exact steps, product visiblity work.

Thanks

February 11, 2019 at 9:24 am #3181674

Itamar
Supporter

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

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

Thanks, Vittorio.

This is exactly the issue that is already known to us. I can replicate this issue on a clean WordPress installation. You can also see a reference for this issue in another forum ticket here. https://wpml.org/forums/topic/catalog-visibility-is-not-changing/

I'm now escalating this ticket to our second tier supporters, and they will check this issue. We'll keep you updated here for any news about this issue.

Thank you for your patience.
Itamar.

February 11, 2019 at 4:38 pm #3184352

Itamar
Supporter

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

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

Hi,

Our second tier supporter has found a fix for this issue and escalated it to our developers so they will check it and include it in a future version of WooCommerce Multilingual. Here is what you can do for now.

1. Take a backup of your site.
2. Open this file with a code editor.
/wp-content/plugins/woocommerce-multilingual/inc/translation-editor/class-wcml-synchronize-product-data.php
3. Insert this line

array_shift($translations);

Before this:

foreach ( $translations as $translation ) {
	if( $product_id !== $translation ){
	     wp_set_post_terms( $translation, $terms, 'product_visibility', false );
	}
}

4. Save the changes.
Now the issue should not happen anymore.

I'll keep you updated here when the fix will be released.

Thank you for your patience.
Itamar.

February 11, 2019 at 6:22 pm #3184865

vittorioS-2

Sorry Itamar but this fix not solve problem.

They work ONLY if product NOT have a translation.

My situation is:
Primary Language: IT
Secondary Language: EN
product A only in IT language
product B with IT and EN languages

If change catalog visiibily for product A work.
If change catalog visibility for product B (in it or en language) NOT work.

I have verified that the problem if caused from differente data type on foreach loop;
$translations is an array of string data, $product_id is an integer.
I added an (int) to convert $translations string into integer value and now work properly in all my cases.

foreach ( $translations as $translation ) {
	if( $product_id !== (int)$translation ){
		wp_set_post_terms( $translation, $terms, 'product_visibility', false );
	}
}

file: /wp-content/plugins/woocommerce-multilingual/inc/translation-editor/class-wcml-synchronize-product-data.php
row: 716~720

Thanks,
Vittorio

February 26, 2019 at 11:18 am #3244436

Itamar
Supporter

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

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

Hi, Vittorio.

This issue supposes to be fixed with the latest version of WooCommerce Multilingual (4.4.2.1).
Could you please update and confirm that it is OK now?

Thanks,
Itamar.