Skip Navigation

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

Problem:
The client experienced a conflict between the WooCommerce Multilingual plugin and WC Memberships, which broke the checkout process. Specifically, adding products to the cart was failing, showing an 'Empty Cart' message unless certain plugins were disabled.
Solution:
We recommended implementing a custom code fix. Here are the steps:
1. Navigate to WP-admin → Plugins → Plugin File Editor.
2. Open the WooCommerce Multilingual & Multicurrency plugin.
3. Go to the folder: compatibility → WcMemberships.
4. Open the file: class-wcml-wc-memberships.php.
5. Scroll to line 147 which contains: return $result;.
6. Place the cursor on line 146 and add the following code:

// Workaround for Fully Being<br />if (empty($result)) {<br />    return $object_ids;<br />}

7. Click on Save.
This adjustment is a temporary workaround. We also suggested checking the errata documentation for WooCommerce Memberships restrict content conditions at https://wpml.org/errata/woocommerce-memberships-restrict-content-conditions-applies-to-all-pages-across-the-site/ for related issues.

If this solution does not resolve your issue or seems irrelevant due to being outdated or not applicable to your case, please open a new support ticket. 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. For further assistance, visit our support forum at https://wpml.org/forums/.

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

Last updated by Bobby 5 months, 1 week ago.

Assisted by: Bobby.

Author Posts
May 7, 2024 at 1:16 pm #15602209

spaffordA

We found a conflict between Woocommerce Multilingual plugin and WC Memberships. The Multilingual plugin broke the checkout process.

We asked a WPLM consultant, Boris Hoekmeijer, to look at this, and he determined that a small piece of code in the WC Multilingual plugin would fix the issue. He suggested that this code might be added an update of the plugin. Here are his comments.

Implement the following custom code on the live website.
Go to WP-admin à Plugins à Plugin File Editor
Open the WooCommerce Multilingual & Multicurrency plugin
Go to the following folder: compatibility à WcMemberships
Open the class-wcml-wc-memberships.php file
Scroll to line 147. It says: return $result;
No set your cursor on line 146 and add the following:

// Workaround for Fully Being

if ( empty($result) ) {

    return $object_ids;

}

Click on Save.
It’s really a very small adjustment, and simple to do. Don’t forget the // before “Workaround for Fully Being”, because that means it’s interpreted by PHP as comment, not as actual code.
At the same time, open a support ticket on WPML and ask them why the workaround for this conflict has not been implemented yet. I would definitely refer to the ticket from august last year. It’s a minute change for them, strange that it wasn’t implemented yet.
Once this is done, the custom code is no longer needed.
If you want, I can create the ticket.

The ticket from last year that he is referring to is:

https://wpml.org/forums/topic/woocommerce-memberships-add-on/#:~:text=As%20of%20version%205.1.0.%20of%20the%20WooCommerce,the%20WooCommerce%20Memberships%20add%2Don.%20We%20noticed%20this

Please let us know of questions; I can put you in touch directly with Boris.

THANK YOU

May 8, 2024 at 11:25 pm #15607981

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Hi there,

Thank you for sharing the custom solution as I am sure this will be beneficial to others that might experience the same issue.

I would however, like to clarify something first. The previous ticket mentioned, is this the same issue you are experiencing?

We have an open errata documentation with a workaround for the issue mentioned in the previous thread here:
https://wpml.org/errata/woocommerce-memberships-restrict-content-conditions-applies-to-all-pages-across-the-site/

Please review it and let me know if the issue you are experiencing is the same

May 9, 2024 at 1:59 pm #15610922

spaffordA

Hi Bobby,

that is the same workaround my WPML consultant tested for us, only the duplicate part of the workaround code stripped to only the changed part. It did not solve the issue.

May 9, 2024 at 7:33 pm #15612266

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Thank you for clarifying and just to verify is the issue you were experiencing the same issue as the one in our errata documentation or different?

The reason I ask is so I can give our team a clear description of what you were experiencing and how the code provided above resolved it.

May 10, 2024 at 6:48 am #15612705

spaffordA

Hi Bobby,

now, the code did not resolve it.

The exact problem we are facing is this:

The normal process should be that when a customer adds a product (subscription) to the basket, he is automatically redirected to the checkout process. English is the default language.

But what happens now is this:
1. when we activate the WooCommerce Multilingual add-on (including the workaround code makes no difference)
2. and a customer adds a product to his basket
3. the customer is redirected to an empty basket/checkout page

I'll include two screenshots, both with Woo ML activated:
1. the english checkout page that appears when adding a product to the basket in english.
2. the spanish empty cart page that appears when adding a product to the basket in spanish.

Fully-being-spanish-empty-cart-when-woo-multilanguage-activated.jpg
Fully-being-english-cart-when-woo-multilanguage-activated.jpg
May 10, 2024 at 8:11 pm #15616338

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Thank you for the detailed breakdown of the issue.

This is a different issue from the one addressed in the shared ticket and the Errata Documentation.

I have created a sandbox environment for us to further investigate.

hidden link

Please use the above link, upload WC Memberships to the sandbox, and set it up with the redirection to the cart once a product is added.

Once ready please update me here and I will investigate further with our team.

May 17, 2024 at 6:19 am #15637612

spaffordA

Hi there,

Sorry for the delay! I have been on vacation this week, and am hoping to continue working on this issue next week, and appreciate if the ticket remains open, if possible.

Thank you!

May 17, 2024 at 7:34 pm #15640877

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Thank you for the update, I have also extended the sandbox from auto-deleting.

May 21, 2024 at 1:14 am #15647537

spaffordA

Hi Bobby, thanks for keeping this ticket open. I have explored this issue further, both on your sandbox environment and also on a clone of our website, where I have disabled all plugins (except the ones in your sandbox site) and reverted to a standard theme.

I am not able to reproduce the problem in the sandbox environment, but the problem persists in our staging environment. In our staging environment, the problem is resolved when I deactivate the Woo Membership plugin OR when I deactivate the WPML Strings plugin. Very strange.

I am not sure how best to proceed. Is it possible to reset the Strings plugin to default settings? Or perhaps the membership settings? Could a setting be causing the error we are getting?

Can I give you access to our staging environment to take a look? I can provide a few more details.

Thank you kindly for the assistance 🙂

May 21, 2024 at 6:25 pm #15652351

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Thank you for the update!

You are likely correct about it being a setting from the plugin that might be translated and should not be within WPML String Translation.

You can go to WPML->String Translation and locate the plugin's domain then delete it affecting only the translations for this plugin and not everything.

"To delete all the untranslated strings belonging to a certain domain, scroll down to Remove strings by domain and click Remove strings. Select the domains of strings you don’t need anymore and click Remove. The untranslated strings in these domains will no longer appear on the String Translation screen."

More information can be found here

Try this and if it does not work as expected, I'd like to look closer. I have enabled the private field reply to share access with me.

May 24, 2024 at 4:04 pm #15668606

spaffordA

Hi there, just thought I would checkin about this ticket to make sure the ticket is still open and in progress. Thank you!!

May 28, 2024 at 1:39 pm #15678928

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Hi there,

We are currently testing this and will update you shortly, thank you for your patience

May 28, 2024 at 4:50 pm #15679898

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Hello,

When testing this I have not been able to reproduce it either on the sandbox or the staging site provided using these links:

hidden link

hidden link

On your staging site it is working OK for me but you mentioned it is not working for you. What are your results if you test in an incognito window or a different browser?

Screen Shot 2024-05-28 at 9.49.58 AM.png
May 29, 2024 at 10:52 pm #15685537

spaffordA

Hi Bobby, thanks for testing this. This is very strange, because when I test on any browser, including incognito and private, I get an 'Empty Cart' result.

Let me check with my colleagues and see what they get. Thank you!

May 29, 2024 at 11:19 pm #15685563

spaffordA

Just a quick follow-up. I found that the link works IF I AM LOGGED IN (AS AN ADMIN):

hidden link

But otherwise the link goes to an empty cart. Does this mean anything to you?