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: Compatibility, Known issue
This topic contains 24 replies, has 3 voices.
Last updated by Diego Pereira 1 year, 10 months ago.
Assisted by: Waqas Bin Hasan.
Author | Posts |
---|---|
July 17, 2023 at 6:52 pm #14053115 | |
mariaA-45 |
Tell us what you are trying to do? Now, when buying a membership product in the main language, the customer is enrolled in the corresponding membership (expected) and also enrolled in the translated membership (not necessarily expected). The real problem is this though: when buying a *translated* membership product, the customer is *not* enrolled in any memberships (definitely not expected) and I can't figure out why. Is there any documentation that you are following? Is there a similar example that we can see? What is the link to your site? |
July 18, 2023 at 9:16 am #14056873 | |
Waqas Bin Hasan WPML Supporter since 05/2014
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Hi, Thank you for contacting the support. Yes please provide the access to the staging site, as well as, the detailed steps to observe and understand the problem. Please also deactivate all unnecessary plugins on the staging, so the issue can be reproduced with a minimal setup. Remember to take full backup of the site beforehand. I've set your next reply as private to provide the information safely. Regards. |
July 18, 2023 at 2:03 pm #14059903 | |
Waqas Bin Hasan WPML Supporter since 05/2014
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for providing the access. I am working on this and 'll get back to you as soon as I find something or have a solution. |
July 19, 2023 at 8:40 am #14063679 | |
Waqas Bin Hasan WPML Supporter since 05/2014
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for your patience on this. I tried the steps exactly you mentioned and found the issue. But, then I deactivated all plugins except WPML's and WC's (see plugins page), switched to a standard WP theme 2023 and tried a few times and it seems to work just fine (see attached images). Can you retry and see if you can reproduce the issue in current situation? If not, then please try followings: - Switch back to your theme and reproduce. This way we can see if another plugin or theme is causing this issue. Please let me know. |
July 19, 2023 at 11:09 am #14065581 | |
mariaA-45 |
Hi, and thanks for your effort. Unfortunately, I cannot confirm that it works now. As a matter of fact, the behavior is exactly as originally described above, i.e. I see two memberships, when ordering the Danish product and I see no membership at all, when ordering the English translation of that product. My guess is that you confused yourself by not cleaning up your orders before testing orders in different languages. Your screenshots even confirms that. If (and only if), the order process works correctly, then the Thank-You page will contain an extra paragraph describing, which membership your account was enrolled in due to your purchase. None of your two screenshots contains that paragraph. Please see the thick-bordered red box in my screenshot for details. For your further testing, please note these mechanics: For details on how to remove orders and memberships, please refer to my howto sent along with the temp. login link in my previous (private) message. Thanks again for your help! |
July 19, 2023 at 1:13 pm #14066413 | |
Waqas Bin Hasan WPML Supporter since 05/2014
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Yes, that makes sense. Thank you for clarifying. I'll do my tests again and proceed accordingly. I am working on it and 'll update you as soon as I've more information or a solution. |
July 20, 2023 at 6:51 am #14069301 | |
Waqas Bin Hasan WPML Supporter since 05/2014
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for waiting on this, I understand the problem now and looks like I need to escalate the issue to the relevant team. May I ask for a copy of your website to test in another environment and for escalation? This way we'll be able to figure out the problem more efficiently and provide a relevant solution. Please see https://wpml.org/faq/provide-supporters-copy-site/ for more details. I've set your next reply as private to share this information safely. Or please let me know, I can create a package using Duplicator plugin. |
July 20, 2023 at 8:36 am #14070309 | |
mariaA-45 |
Hi there, - Cleaned the database from all customer data and removed the biggest media files (lots of videos on my site). Please download the duplicator package directly from the staging sites back end. Thanks! |
July 20, 2023 at 1:15 pm #14072683 | |
Waqas Bin Hasan WPML Supporter since 05/2014
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for your cooperation. I've downloaded the package and 've escalated the matter to the 2nd tier team. I'll update you as soon as I hear back. |
July 21, 2023 at 6:18 am #14075985 | |
Waqas Bin Hasan WPML Supporter since 05/2014
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Just an update, that, matter is now with our compatibility team. Because plugin is on our compatibility list and there, perhaps, something needs to be taken care of. I'll update you as soon as I've more information. |
July 27, 2023 at 5:31 am #14107709 | |
Waqas Bin Hasan WPML Supporter since 05/2014
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for your patience on this. We've tried the site package on local and then tried to reproduce in another environment but without any luck. I've prepared this hidden link fresh sandbox site with the same plugins active as in the package. Only WPML is configured. Can you please activate and configure other plugins? And then create one or two sample products with sample memberships, and, then reproduce the issue in the sandbox? While you are doing this, please take note of any special steps or settings needed to setup the plugins and/or products and memberships. This 'll help understanding the process. Please let me know. |
July 28, 2023 at 3:09 am #14114461 | |
mariaA-45 |
Hi there, I configured all necessary plugins, pages and memberships in your sandbox and was able to reproduce the original issue. I took notes of these steps along the way: - Plugins: enable WooCommerce - WooCommerce Setup Wizard: - WooCommerce, Settings: - Plugins: enabled WooCommerce Multilingual & Multicurrency - Products: Create product: - Pages: Create page - Plugins: enable WooCommerce Memberships - Plugins: WooCommerce Memberships => Setup - WooCommerce => Memberships => Membership Plans => "VIP Membership" => Edit - WooCommerce => Memberships => Membership Plans => "VIP Membership" => Add English translation "VIP Membership EN" - Marketing => Coupons => Add Coupon - Visit site in Private Mode (so we're no longer logged on as site-admin): - Visit store in Private Mode and purchase product in MAIN language using coupon code "vip" (just to make test checkouts faster) - Now in WordPress back end - Visit store in Private Mode and purchase product in ENGLISH language using coupon code "vip" (just to make test checkouts faster) Best, |
July 28, 2023 at 7:03 am #14114837 | |
Waqas Bin Hasan WPML Supporter since 05/2014
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thanks a lot Maria, that was awesome and of great help. I've escalated the issue to our compatibility team and 'll update you as soon as there's some progress or information. Have a great weekend. |
August 2, 2023 at 5:52 am #14138827 | |
Waqas Bin Hasan WPML Supporter since 05/2014
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for your patience and cooperation. Our team has identified the problems and have escalated the matters to relevant dev and compatibility teams. For now they offer following workarounds to the identified problems. We've applied these on our sandbox and 've tested. Please consider followings and apply these first on your staging site: IMPORTANT: Take full backup before proceeding!! Issue #1: Restricted content visible in second language We found that the issue happens because the translation is using the same slug as the default language. Modified the slug and now it works as expected (not visible for all users): i.e. hidden link Issue #2: Memberships from other languages being displayed on thank-you page This can be solved with the following workaround: - Open the "wp-content\plugins\woocommerce-memberships\src\functions\wc-memberships-functions-orders.php" file foreach ( $memberships as $membership_id => $data ) { if ( 'yes' === $data['already_granted'] ) { $user_membership = wc_memberships_get_user_membership( (int) $membership_id ); $membership_plan = $user_membership ? $user_membership->get_plan() : null; $members_area_sections = $membership_plan ? $membership_plan->get_members_area_sections() : array(); if ( ! empty( $members_area_sections ) ) { $memberships_with_members_area[ $user_membership->get_plan_id() ] = $user_membership->get_plan()->get_name(); } } } With: foreach ( $memberships as $membership_id => $data ) { if ( 'yes' === $data['already_granted'] ) { $user_membership = wc_memberships_get_user_membership( (int) $membership_id ); $membership_plan = $user_membership ? $user_membership->get_plan() : null; $members_area_sections = $membership_plan ? $membership_plan->get_members_area_sections() : array(); // WPML workaround for compsupp-6889 - Issue #2 if (class_exists('Sitepress')) { $wpml_current_lang = apply_filters( 'wpml_current_language', NULL ); $args = array('element_id' => $membership_plan->id, 'element_type' => 'wc_membership_plan' ); $membership_id_language_info = apply_filters( 'wpml_element_language_details', null, $args ); if ( $wpml_current_lang != $membership_id_language_info->language_code) { $members_area_sections = array(); } } if ( ! empty( $members_area_sections ) ) { $memberships_with_members_area[ $user_membership->get_plan_id() ] = $user_membership->get_plan()->get_name(); } } } PS: Now, as we have only one membership, it will display a different message. This is expected. Issue #3: No membership assigned when purchasing product from 2nd language This can be solved with the following workaround: - Open the "wp-content\plugins\woocommerce-memberships\src\class-wc-memberships-membership-plan.php" file public function get_product_ids() { if ( null === $this->product_ids ) { $this->product_ids = get_post_meta( $this->id, $this->product_ids_meta, true ); $this->product_ids = is_array( $this->product_ids ) ? array_unique( array_map( 'absint', $this->product_ids ) ) : []; } return $this->product_ids; } With: public function get_product_ids() { if ( null === $this->product_ids ) { $this->product_ids = get_post_meta( $this->id, $this->product_ids_meta, true ); $this->product_ids = apply_filters( 'wc_memberships_rule_object_ids', $this->product_ids ); $this->product_ids = is_array( $this->product_ids ) ? array_unique( array_map( 'absint', $this->product_ids ) ) : []; } return $this->product_ids; } Please try these and let me know. |
August 2, 2023 at 9:55 am #14140939 | |
mariaA-45 |
Hi there, I did test this in your sandbox and I see a row of problems - did you apply the above work arounds to the sandbox? I'll describe, what I see step by step: Step 1: Observations: Step 2: Observations: Step 3: Observations: Step 3: Observations: Step 4: Observations: Step 5: Observations: I might misunderstand the basic concepts of how WPML handles memberships plans. I noticed that memberships as listed at hidden link can have translations, too. So perhaps being enrolled in one membership plan, should result in me becoming member of that plan, but also member of all plan translations, however via automatically translating the membership rather than being enrolled in all translated membership plans? Either way, in its current state WPML does not work for WooCommerce Memberships - not even without trigger products. |