• Resolved kram09890

    (@kram09890)


    Hello!

    I have a multilingual website. And users can go through the checkout process in different languages. We have these two checkout pages and everything works fine and is translated:

    • scienhub.test/en/checkout/
    • scienhub.test/ca/pagament/

    But when the purchase is finished, both of them redirect to:

    scienhub.test/en/checkout/order-received/964/?key=wc_order_f9DH02UaRDmJc

    If I manually introduce the same address in other languages by changing the locale in the URL, everything looks fine and is translated. Like:

    scienhub.test/ca/checkout/order-received/964/?key=wc_order_f9DH02UaRDmJc

    So, why doesn’t WooCommerce take the user to the correct page? Is this a bug? How can we solve it?

    I’ve tried using add_action(‘woocommerce_thankyou’, …) in different ways, but I can’t retrieve the initial language the checkout page is being visited in.

    Thanks a lot!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Hey there, @kram09890! Thanks for contacting us. I’m happy to help you.

    Do you mind sharing more details about how you set up the multilingual site so we can investigate this further?

    Which plugins are you using for that?

    Are you using custom code?

    Furthermore, I’d like to understand your site properly. Please share with us the necessary information below for us to investigate the issue further:

    System Status Report which you can find via WooCommerce > Status > Get system report > Copy for support.
    Fatal error logs (if any) under WooCommerce > Status > Logs. Then you can use the selector to search for Fatal Errors.
    You could copy and paste your reply here or paste it via https://gist.github.com/ and send the link here.

    Looking forward to your reply.

    Have a wonderful day!

    Thread Starter kram09890

    (@kram09890)

    Hi Carol,

    and thanks for the quick reply! ??

    We are using the free version of Polylang. It basically creates different posts/pages for each language. We also use Loco Translate for the theme and plugins, but I believe it is not relevant.

    Not all post types are multilingual, so this is an average process:

    1. Post type “Registration”, in Catalan: https://scienhub.org/ca/registration/acuc-2024/ (It’s a custom post type that lists selected products)
    2. Variable Product post, products are language agnostic: https://scienhub.org/product/registre-acuc-2024/ (Last option costs 0€, for testing).
    3. Checkout Page, in Catalan: https://scienhub.org/ca/pagament/ (through the side cart)
    4. Checkout Page, after payment, in English. <- Here is the problem.

    We are using custom code in many different functionalities, but not in here. The Checkout template is basically just using the [woocommerce_checkout] shortcode. The products are Tickets created with Tickera. But it should be relevant either.

    You will find the reports in https://gist.github.com/mcamprecios/9cca8d9adcc75277d34e0a21ebc1ab16

    Massive thanks again!

    Thread Starter kram09890

    (@kram09890)

    Hi Carol, or support team ??

    Any update on this?

    Thanks again!

    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @kram09890,

    After reviewing your detailed explanation, it seems like there might be a conflict between the Polylang plugin and how WooCommerce handles checkout redirections.

    We’ve seen cases where the issue is related to how the language plugin handles URLs, and it could be that Polylang isn’t correctly translating the URL on redirect.

    Since this is a third-party plugin which we don’t provide support for (please see our Support Policy), it would be best to reach out to the plugin’s developers as they might have more insights into this issue. I am sure they will have no problem supporting you there.

    Let us know how that goes! Looking forward to hearing from you!

    Thread Starter kram09890

    (@kram09890)

    Thanks and sorry for the late response.

    I’ve asked the same question on their support forum, but will keep this issue open in case anyone hase any insights.

    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @kram09890,

    That sounds like a plan.

    We’ll keep this thread open for a bit to see if anyone from the community can lend a hand.

    Let us know how that goes.

    Thread Starter kram09890

    (@kram09890)

    Hi @shameenreza,

    I was wondering if you could give me advice to custom code the solution myself;

    Is it possible to change the address where the users are directed –the Thank You page–, right after the payment goes through but before opening the Thank You page?

    If it is possible, I could probably create the URL dynamicaly given the language and the order ID.

    Does it make sense?

    Thanks a lot!

    Plugin Support ckadenge (woo-hc)

    (@ckadenge)

    Hi @kram09890,

    it’s possible to change the address where users are directed to after payment. You can customize the ‘Thank You’ page URL by using the ‘woocommerce_thankyou’ hook. This allows you to create a dynamic URL based on the order ID.

    You can find more details about this from this external link here.

    I hope this point s you in the right direction.

    All the best.

    Thread Starter kram09890

    (@kram09890)

    Thanks for your message!

    As you will see in my original post, I’m afraid I already tried it.

    The problem is that the ‘woocommerce_thankyou’ action redirects to a specific page right after opening the original Thank You page, not before.

    And our problem is that it is always opening the Thank You page in English, disregarding the language selected. Hence we can’t know the language the user was navigating in easily.

    I believe that the only option using this hook is to work using cookies, which we would prefer to avoid.

    Let’s see if someone else has an idea!

    Plugin Support ckadenge (woo-hc)

    (@ckadenge)

    Hi there @kram09890,

    I would recommend the following:

    1. Running the exact question you’re asking, along with the code provided, through an AI platform like ChatGPT for recommendations/changes to your code;
    2. Checking whether there are existing plugins in the WordPress plugin repository that might be doing that already.
    3. Joining our WooCommerce Slack community (it does have a developer channel where you can ask coding questions): https://woo.com/community-slack/

    Hope it helps!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘WooCommerce redirects to the wrong language Checkout Completed page’ is closed to new replies.