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.

Tagged: 

This topic contains 13 replies, has 3 voices.

Last updated by Dražen 1 year, 6 months ago.

Assisted by: Dražen.

Author Posts
August 1, 2023 at 7:24 am #14130839

erikd-13

As of version 5.1.0. of the WooCommerce Multilingual plugin we have a conflict with this plugin and the WooCommerce Memberships add-on. We noticed this only recently, as the behaviour of the error is not completely consistent.

August 1, 2023 at 7:55 am #14131041

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

this is the ticket, I will update you when I have some news from the compatibility team.

Regards,
Drazen

August 2, 2023 at 6:33 am #14139123

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

please try the next workaround:

- Open the "wp-content\plugins\woocommerce-multilingual\compatibility\WcMemberships\class-wcml-wc-memberships.php" file

- Replace the "WCML_WC_Memberships::add_translated_object_ids()" method (around line 134):

public function add_translated_object_ids( $object_ids ) {
	$result = [];
	foreach ( $object_ids as $object_id ) {
		$type         = apply_filters( 'wpml_element_type', get_post_type( $object_id ) );
		$trid         = apply_filters( 'wpml_element_trid', null, $object_id, $type );
		$translations = array_values( wp_list_pluck(
			apply_filters( 'wpml_get_element_translations', [], $trid, $type ),
			'element_id'
		) );

		$result = array_merge( $result, $translations );
	}

	return $result;
}

With:

public function add_translated_object_ids( $object_ids ) {
	$result = [];
	foreach ( $object_ids as $object_id ) {
		$type         = apply_filters( 'wpml_element_type', get_post_type( $object_id ) );
		$trid         = apply_filters( 'wpml_element_trid', null, $object_id, $type );
		$translations = array_values( wp_list_pluck(
			apply_filters( 'wpml_get_element_translations', [], $trid, $type ),
			'element_id'
		) );

		$result = array_merge( $result, $translations );
	}

	// Workaround for compsupp-6900
	if ( empty($result) ) {
		return $object_ids;
	}

	return $result;
}

Let me know how it goes.

Regards,
Drazen

August 3, 2023 at 11:51 am #14149229

erikd-13

Hi Drazen,

Tried it, upgraded the plugin to 5.2.0. Applied the patch. It didn't work; the erroneous behaviour of the restrict content function remains the same. Reverted the plugin on the development site back to 5.0.2, which is the last version where the restrict content functionality works as it should.

Regards, Erik

August 3, 2023 at 1:17 pm #14149843

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello Erik,

thanks for getting back.

I created a minimal installation of WordPress, WPML, and all necessary WPML add-ons.

You can access the WordPress dashboard using the link below:
- hidden link

Kindly follow the steps below:
- Try to replicate the issue with simple example
- Share with me step by step guide on how can I check the issue and what you did

This will help us to report the probable issue to the compatibility team and solve the possible problem faster.

Regards,
Drazen

August 7, 2023 at 9:18 am #14162299

erikd-13

Hi Drazen,

As the issue happens with a custom taxonomy created with Toolset Types, could you please add this plugin to the sandbox?

Regards, Erik

August 7, 2023 at 9:32 am #14162365

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello Erik,

it is added.

Regards,
Drazen

August 7, 2023 at 10:47 am #14162983

erikd-13

Hi Drazen,

In the sandbox I can easily replicate the error on my client's website.

- with Toolset Types I created a taxonomy P-categories and assigned it to post-type Pages
- created two P-categories terms (P-category1 and P-category2)
- assignes those to two pages
- created a Membership plan
- added a restrict content rule P-categories and added one of the created P-categories
- saved the Membership plan
- checked the restrict content rules: the P-categories rule was empty

This is exactly the behavior we see on our sites.

You can repeat the error by adding one or two P-category terms to the P-categories Restrict Content rule in the membership I created and save the membership.

Regards,
Erik

August 7, 2023 at 1:02 pm #14163915

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello Erik,

thanks for getting back, I have checked the issue and it seems to be the same as reported, and the workaround works and fixed the issues.

I have added a workaround and tested the issue, it works fine now.

Please check.

Video: hidden link

Regards,
Drazen

August 10, 2023 at 3:30 pm #14183973

erikd-13

Hi Drazen,

Thanks for your video. I checked it on the sandbox myself and I also got a good result. Can you share with me what is the workaround you found, so I can test it on our sites too?

regards,
Erik

August 11, 2023 at 5:57 am #14185923

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello Erik,

the workaround used is the same one I shared with you before.

Reply:

- https://wpml.org/forums/topic/woocommerce-memberships-add-on/#post-14139123

Regards,
Drazen

August 16, 2023 at 1:13 pm #14236043
erikd-13

Hi Drazen,

I tested the workaround on my development site, where I set the environment to as much as possible the same as on the sandbox: same theme, same set of plugins. I even deleted all the Membership plans except one and cancelled all active memberships to make it even more comparable with the sandbox. I tried all sorts of things, like renaming slugs, removing existing P-categories and replacing them with new ones. Some worked, some not but the behaviour remains unpredictable.

So the errors exist and only go away when I either deactivate or downgrade the Woocommerce Multilingual & Multicurrency plugin. Any ideas how we can debug this further?

Regards, Erik

New threads created by Dražen and linked to this one are listed below:

https://wpml.org/forums/topic/split-woocommerce-memberships-sometimes-work/

August 18, 2023 at 10:27 am #14251803

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Hi Erik,

my as my colleague Dražen is off today, I want to inform you about the status of your request.

I forwarded your request to our compatibility team, who is checking your case. Dražen will be back on Monday and will inform you here with an update about it.

Best Regards
Marcel

August 21, 2023 at 6:36 am #14259951

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello Erik,

since we have an escalated ticket related to this issue, and the bug is confirmed, but your problem seems to be different in the end. I will open a new key and let continue our conversation there, to keep things clear.

- https://wpml.org/forums/topic/split-woocommerce-memberships-sometimes-work/

I will update you further there, and suggest we close the current one.

Regards,
Drazen