Support » Plugin: WooCommerce Multilingual - run WooCommerce with WPML » Issue on order-pay endpoint

  • Resolved sardbaba



    WCML_Endpoints overwrites each element of the array WC()->query->query_vars with each element returned by get_endpoint_translation().
    In the case of “order-pay”, this seems to be empty so that WC()->query->query_vars[‘order-pay’] is empty and this causes the endpoint order-pay to be unavailable.

    Please see my detailed description of the issue here:

    System info:

    – WPML Multilingual CMS – by OnTheGoSystems – 3.3.3
    – WooCommerce Multilingual – by OnTheGoSystems – 3.7.6
    – WooCommerce – by WooThemes – 2.4.12
    – WPML Media – by OnTheGoSystems – 2.1.17
    – WPML String Translation – by OnTheGoSystems – 2.3.4
    – WPML Translation Management – by OnTheGoSystems – 2.1.3

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Support George Botsev


    Hello and thank you for reporting this issue.
    Can you provide more information please on how I can reproduce this problem?
    In my tests the endpoint is available, so I might be doing something wrong and perhaps skipping a vital step.

    Hi George

    thanks for looking into this.
    To replicate the issue you have to test first that the /checkout/order-pay/ endpoint is working correctly (so a page is shown, even if blank). Then:

    • change the permalink structure from %postname% to another one
    • save changes
    • change back to %postname%
    • save changes

    The endpoint “order-pay” should not be available anymore (a not found page should be shown).
    Then, if you save changes in the “wp-admin/admin.php?page=wc-settings&tab=checkout” page, the endpoint order-pay should be working again because the permalink structure is flushed.

    Let me know if you can reproduce this issue.

    Plugin Support George Botsev


    Unfortunately, I am unable to reproduce the issue.
    Perhaps there are some other steps/configuration that I need to do before that.
    For me the page is always available.
    Just to be on the safe side – perhaps it would be a good idea if you could test with latest WPML version that we just released – 3.3.4

    Yep, probably the site (which is not mine) has some other configurations which makes difficult to reproduce the issue.
    Anyway I saw this problem also on another website (which, again, is not mine) so my solution

    if ( empty(WC()->query->query_vars['order-pay']) ) {

    can be useful to someone.

    Anyway, thank you for your time

    I also have this issue with my checkout.

    sardbaba, where do I have to use the above code?

    Hi costas90

    you can attach the code to the woocommerce_checkout_init action.
    So adding this code:

    add_action('woocommerce_checkout_init', 'yourthemename_woocommerce_checkout_init' );
    function yourthemename_woocommerce_checkout_init() {
      if ( empty(WC()->query->query_vars['order-pay']) ) {

    into your functions.php file (this file is under the theme folder), should be fine.

    Thank you! This has worked for me.

    I pasted the code at the begin of the functions.php right after the opening PHP tag.

    Is is better if its at the end of the file instead?

    Great! 😉

    It can be placed anywhere on the file.

    For a more in deep explanation of actions and filters please read this great article.

    Plugin Support George Botsev


    I wonder if this issue may be related to the bug in WordPress Core:
    Because in WPML we have a work-around for this:

    I’m not really sure if it can be this the problem.
    Under class WCML_Endpoints,

    function register_endpoints_translations(){
            if( !class_exists( 'woocommerce' ) || !defined( 'ICL_SITEPRESS_VERSION' ) || ICL_PLUGIN_INACTIVE || version_compare( WOOCOMMERCE_VERSION, '2.2', '<' ) ) return false;
            $wc_vars = WC()->query->query_vars; // (1)
            if ( !empty( $wc_vars ) ){
                $query_vars = array(
                    // Checkout actions
                    'order-pay'          => $this->get_endpoint_translation( 'order-pay', $wc_vars['order-pay'] ), // (2)
                    'order-received'     => $this->get_endpoint_translation( 'order-received', $wc_vars['order-received'] ), // (3)

    on (1) $wc_vars[‘order-pay’] is set to “order-pay”, but on (2) it looses its value. On (3) the value is present.

    I really don’t know why this happens but it is so.

    Plugin Support George Botsev


    I have escalated this to our developers to take a look.
    I will get back to you when they respond and provide more information.

    ok thanks

    Plugin Support George Botsev


    Okay, we are unable to reproduce the problem, so it would be very beneficial if you can create a ticket in forum with the same question, so that we can investigate further and get a duplicator package with one of your site that is affected.

    Plugin Support George Botsev


    We still have not been able to reproduce the problem, however one customer reprted that translating the endpoing in WPML > String Translation resolves the issue.
    Please search for the order-pay string in WPML > String Translation and assign it some translation.

    Let me know if this helps for you.

    Hi George

    thanks, it seems to work even if it would need more checks.

    Anyway I think the best way to handle this kind of problem is in the source of the problem which, based on my debugging, seems to be on the function WCML_Endpoints->get_endpoint_translation().
    This function should return the original value if no translation is found.

    Hope this helps


Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Issue on order-pay endpoint’ is closed to new replies.