[Resolved] Woocommerce Multilingual Conflict with WC Membership
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:
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.
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:
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.
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.
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.
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.
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."
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?
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!