• Resolved Vertiges

    (@vertiges)


    Hello,

    Thank you for maintaining this plugin and making it available for free. I use it across several of my WooCommerce sites and it has been reliable and easy to work with. I truly appreciate the work your team puts into it.

    I am running a bilingual WooCommerce store (French/English) using Polylang and Polylang for WooCommerce. I recently updated to version 9.0.56, which mentions Polylang compatibility improvements.

    After extensive testing, I have identified two remaining issues that appear specific to your plugin’s PayPal checkout flow:

    1. Order confirmation email sent in the wrong language

    When an English-language customer completes a PayPal payment, the order confirmation email is sent in French (the site default language) instead of English.

    This behavior does not occur with other payment methods (e.g., cheque). With those methods, emails are correctly sent in the customer’s language.

    From debugging, it appears the email is triggered in a context where WordPress translations are already loaded in the site default locale (fr_CA). Because the translations are already cached in memory at that point, the standard WooCommerce / Polylang email locale switching mechanism does not take effect.

    1. Order-received page redirects to the wrong language

    After a PayPal payment, the customer is redirected to:

    /commande/order-received/

    instead of:

    /en/checkout/order-received/

    This also works correctly with other payment methods. The issue seems limited to your plugin’s flow involving the /wc-api/ endpoint.

    From investigation, it appears the return URL is built using the default checkout page without applying Polylang’s language context, likely because the /wc-api/ request runs outside Polylang’s normal language bootstrap.

    Environment

    • Plugin version: 9.0.56
    • WooCommerce: latest
    • Polylang for WooCommerce: latest
    • Languages: fr_CA (default) and en_US
    • WordPress: latest

    I have implemented temporary workarounds for both issues with custom code, but these behaviors ideally should be handled natively by the plugin’s Polylang compatibility layer.

    Note: I was unable to find a working solution for the email language issue. The translations are already cached in memory before the email is sent, making a runtime locale switch ineffective.

    Please let me know if you need additional details, reproduction steps, or debug logs.

    Thank you.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support Jignesh

    (@jigneshmpatel)

    Hello,

    Thank you very much for the detailed report and for the kind words about the plugin — we truly appreciate it.

    I’m currently reviewing the behavior you described and working on reproducing both issues (email language and order-received redirect) in a Polylang + WooCommerce setup on my end.

    As soon as I have more clarity, findings, or a proposed solution, I will update you here.

    Thank you for your patience and for providing such thorough debugging information — it’s very helpful.

    Best regards

    Plugin Support Jignesh

    (@jigneshmpatel)

    Hello,

    We have included a fix for the issue you reported in this version (9.0.57.1) : Download Link

    Please try this and let us know how it works for you 

    Best Regards

    Thread Starter Vertiges

    (@vertiges)

    Hello Jignesh,

    Thank you so much for the incredibly fast turnaround — a fix in less than 24 hours for a free plugin is truly exceptional. We really appreciate it.

    After testing version 9.0.57.1, here are the results:

    ✅ Order-received page now redirects to the correct language
    ✅ Order confirmation email is now sent in the correct language

    One small remaining issue:
    The order date in the confirmation email still appears in the site default language (French) instead of the customer’s language. For example, an English customer receives: [Order #26598] (février, 27 2026) — the month name is in French.

    Separate issue — validation error messages:
    When a customer clicks the PayPal button without filling in the required billing fields, the validation error messages appear in the wrong language (French instead of English). This happens because the PayPal button triggers a /wc-api/ request where Polylang does not apply its language detection.

    We were able to work around this with the following code, which may be useful for your Polylang compatibility implementation:

    add_filter( 'determine_locale', function( $locale ) {
    if ( is_admin() ) {
    return $locale;
    }
    $uri = $_SERVER['REQUEST_URI'] ?? '';
    $is_wc_ajax = ! empty( $_REQUEST['wc-ajax'] );
    $is_wc_api = ( strpos( $uri, '/wc-api/' ) !== false );
    if ( ! $is_wc_ajax && ! $is_wc_api ) {
    return $locale;
    }
    $pll_slug = isset( $_COOKIE['pll_language'] )
    ? sanitize_key( $_COOKIE['pll_language'] )
    : '';
    if ( $pll_slug === 'en' ) return 'en_US';
    if ( $pll_slug === 'fr' ) return 'fr_CA';
    return $locale;
    }, 0 );

    Note: the locale mapping (en → en_US, fr → fr_CA) is specific to our site. A more generic implementation could read the locale directly from Polylang’s language model.

    Thank you again for your responsiveness and dedication to this plugin.

    Best regards

    I’d suggest checking the current language through the plugin API instead of relying only on cookies. That makes the logic safer for WPML and other multilingual plugins. In Polylang, cookies can also be disabled, so reading the language directly from a cookie is not always reliable.

    function easy_get_current_language_slug() {
    // Polylang
    if ( function_exists( 'pll_current_language' ) ) {
    $lang = pll_current_language( 'slug' );

    if ( ! empty( $lang ) && is_string( $lang ) ) {
    return sanitize_key( $lang );
    }
    }

    // WPML
    $lang = apply_filters( 'wpml_current_language', null );

    if ( ! empty( $lang ) && is_string( $lang ) ) {
    return sanitize_key( $lang );
    }

    // Fallback
    return '';
    }

    In my case, the PayPal plugin passes the locale correctly, but the direct card payment on the website does not. That flow uses fetch() and sends the request to:

    /wc-api/PPCP_Paypal_Checkout_For_Woocommerce_Button_Manager/?ppcp_action=create_order

    Because of that, the language is not always resolved correctly during order creation.

    Thread Starter Vertiges

    (@vertiges)

    Thank you for the suggestion.

    In our testing, pll_current_language() returns an empty value in the /wc-api/ context, which is essentially the root of the issue. At that point Polylang has not fully bootstrapped the language, so the Polylang API is not reliable there and can’t be used as a sole source of truth for locale switching.

    Regarding cookies being disabled: Polylang’s front-end language selection relies on its language cookie. If that cookie is absent, the bilingual site behavior becomes inconsistent anyway (e.g., language context can’t be persisted across requests). In practice, the cookie is therefore a safe and reliable signal specifically for these technical endpoint requests.

    That said, I agree that the most compatible approach would be:

    • Try pll_current_language('slug') first when it returns a valid value,
    • and fall back to the Polylang cookie (and/or a language parameter in the return URL) when it does not.

    We have not yet tested whether the direct credit card flow behaves differently for the order-received redirect and notification emails. If you have tested that flow, I’d be very interested to know whether it reproduces the same behavior in your setup.

    Plugin Support Jignesh

    (@jigneshmpatel)

    Hello,

    We have included a fix for the issue you reported (including email date localization and /wc-api/ language handling) in this version (9.0.57.2) :
    https://drive.google.com/file/d/120UOmEsJrHoOkhzosI_UY98RTXzcxz_5/view?usp=sharing

    Please try this and let us know how it works for you.

    Best Regards

    Thread Starter Vertiges

    (@vertiges)

    Hello Jignesh,

    Thank you very much for the quick turnaround and for providing the patched version.

    I have tested a new order in English, and I can confirm that the month in the confirmation email is now correctly displayed in English. The localization issue appears to be resolved on our side.

    The next step for us will be to test the direct credit card payment flow. I will clone the site and run tests in sandbox mode to verify that the order-received redirect and email localization also behave correctly in that scenario.

    We really appreciate your responsiveness and the effort you put into addressing this.

    Best regards,

    Thread Starter Vertiges

    (@vertiges)

    Hello Jignesh,

    I would like to confirm that we have now completed full end-to-end testing in both languages.

    After testing in sandbox mode with the latest patched version, I can confirm the following:

    1. PayPal button payments (FR and EN)
      • Checkout validation messages display in the correct language
      • Order-received page redirects to the correct language
      • Confirmation emails are fully localized (including month names)
    2. Direct credit card payments (Advanced Card Payments, FR and EN)
      • Checkout validation messages display in the correct language
      • Order-received page redirects to the correct language
      • Confirmation emails are fully localized (including month names)

    All flows now behave correctly from checkout through email notification.

    We also identified a ModSecurity false positive on our hosting environment (rule 340162) blocking the /wc-api/ endpoint used during card processing. After whitelisting that rule, the card flow worked as expected. This appears to be infrastructure-related rather than plugin-related, but I am mentioning it in case it helps other users encountering similar 403 errors.

    At this point, we have removed our temporary locale workaround code, and everything continues to function properly.

    Thank you again for the excellent support and for addressing the Polylang compatibility issues so quickly.

    Best regards,

    Plugin Support Jignesh

    (@jigneshmpatel)

    Hello Vertiges,

    Thank you for the detailed testing and confirmation — we’re glad to hear everything is now working correctly across all flows and languages.

    We also appreciate the note about the ModSecurity rule; that may help other users.

    Thank you again for your excellent feedback and support.

    Best regards

Viewing 9 replies - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.