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 1 reply, has 0 voices.
Last updated by Osama Mersal 1 month, 3 weeks ago.
Assisted by: Osama Mersal.
| Author | Posts |
|---|---|
| February 24, 2026 at 12:41 am #17844685 | |
|
khalidA-55 |
I am running a WooCommerce site using WPML and the WoodMart theme. My business is a US-based LLC, but I am targeting the Moroccan market with an Arabic localized version of the site. The Issue: What we have already attempted (and failed): PHP Filters: We used wc_stripe_show_payment_request_on_checkout and option_woocommerce_stripe_settings checking for ICL_LANGUAGE_CODE === 'ar'. The buttons still render. Script Dequeuing: We attempted to wp_dequeue_script('wc-stripe-payment-request') on the wp_enqueue_scripts hook with priority 9999. The script still loads. Action Removal: We tried remove_action on woocommerce_checkout_before_customer_details referencing the WC_Stripe_Payment_Request instance. CSS Hiding: Adding display: none !important to the CSS Arabic Preset in WoodMart. This worked temporarily but caused layout breakage in the WoodMart Mini-Cart and sometimes the code is wiped by the theme's CSS compiler. JavaScript Mutation Observer: A script to watch for the .wc-stripe-payment-request-wrapper and remove it. The buttons appear to be injected via an iframe or Shadow DOM that bypasses this. Child Theme: We confirmed these tests were performed using a Child Theme to ensure no main-theme overrides were interfering. Technical Environment: Theme: WoodMart (latest version) using Custom Layouts. Multilingual: WPML + WooCommerce Multilingual (WCML). Payment Gateway: WooCommerce Stripe Gateway (using New Checkout Experience/UPE). Server: cloudways environment with Object Caching (cleared during testing). My Question: |
| February 24, 2026 at 2:38 am #17844720 | |
|
Osama Mersal |
Hi, Thanks for contacting WPML forums support. I'll be glad to help you today. WPML/WCML does not include a dedicated hook to disable Stripe Express Checkout by language. Initialization for Apple Pay, Google Pay, and Stripe Link is handled entirely within the WooCommerce Stripe Gateway plugin. WPML can reliably detect the current language, but it does not directly control how Stripe loads its Express features. To achieve what you described, the correct approach is to: 1- Detect the active language using WPML. Below is an example snippet you can place in your child theme's functions.php file or inside a small MU plugin:
<?php
/**
* Disable Stripe Express / Payment Request buttons ONLY for Arabic.
*/
add_action( 'plugins_loaded', function () {
// Ensure WPML is active.
if ( ! has_filter( 'wpml_current_language' ) ) {
return;
}
$lang = apply_filters( 'wpml_current_language', null );
// Disable Express Checkout only for Arabic.
if ( 'ar' === $lang ) {
// Checkout and Cart pages
add_filter( 'wc_stripe_show_payment_request_on_checkout', '__return_false', 999 );
add_filter( 'wc_stripe_show_payment_request_on_cart', '__return_false', 999 );
// Product page (true = hide button)
add_filter( 'wc_stripe_hide_payment_request_on_product_page', '__return_true', 999 );
// Prevent related scripts from loading when disabled
add_filter( 'wc_stripe_load_scripts_on_cart_page_when_prbs_disabled', '__return_false', 999 );
add_filter( 'wc_stripe_load_scripts_on_product_page_when_prbs_disabled', '__return_false', 999 );
}
}, 20 );
This keeps Express Checkout active in English and French, but disables it only when the active language is Arabic. Please note that support for custom code implementation is outside the scope of our forum support. However, this approach follows Stripe's documented filters and should allow you to control the behavior per language. Best regards, |