MarketPress shopping cart language reverts to default after adding/removing products

This must be an AJAX thing, but I don't know how to resolve this. When on a French page, then I add a product to the cart (or empty the cart), upon refreshing the cart widget its contents switch back to being in English. It's the update_cart() AJAX function in marketpress.php that's generating the HTML fragment for the cart, but looking in there I see all gettext wrappers etc being applied, so don't know why this is happening? I've also tried using calling localization() and textdomain('WP') inside this to force the language translation setup, but no joy... Help!

  • Harvey
    • WPMU DEV Initiate

    Hi Kimberley,

    Thanks for your quick reply. I'd already translated the necessary text into French using PoEdit and .po/.mo files in the MP language dir. This is working fine, but the problem is that when I add stuff (or empty) to the shopping cart, the (AJAX) code that updates the cart's contents is being sent the default untranslated text from the server's PHP script every time? The only way to get my cart back in the page's active language is to hit F5 to for a page refresh. I need to resolve this pretty quickly as my site is to go live asap.

  • Kimberly
    • Champion of Loops


    I am not familiar with multilingual sites and how they operate with translation. Forgive me if I am being redundant but I found this while searching one of my thoughts: . I'm not suggesting it's relevant but simply something I found, perhaps you can tell me if this is something I should bookmark as a useful tool when dealing with members and marketpress multilingual sites like yours?

    I've also found this:
    Translating General Texts

    Your e-commerce site includes many small texts that are not part of any page or product. These come from the theme and from WooCommerce.

    Both the theme and WooCommerce should come with their .mo files. You can complete any missing translations using WPML’s String Translation module. Follow the instructions for theme localization.

    Then, go to WPML->String Translation to actually translate the texts.

    All WooCommerce strings are under context ‘plugin woocommerce’. You can use the Search tool to quickly find the texts that you need to translate.

    If none of this helps you to find the gap in why the cart is not being translated then please let me know, I will see who on our staff is most experienced with this to help :slight_smile:



  • Harvey
    • WPMU DEV Initiate

    Hi Kimberley,

    Thanks for your detailed reply. The MarketPress-WMPL plugin is the bridge that between WPML & MarketPress, but I'm not sure this is where the problem lies. Just to be clear, all the bits of text that need translating have been done and work fine, both for products and other text such as shipping forms, buttons, shopping cart text etc. But the issue is that the text for the shopping cart is switching back to English every time I add a product (or empty the cart). Now I know that forcing a refresh on the page will restore the cart back to the actual language the page should be using, so this must be down to the AJAX PHP code that updates just the shopping cart HTML. Could one of the devs look into this as it is critical that I resolve this quickly, here's my site if you'd like to see what I mean:

    Click on the French flag, add items to the cart and watch the text go back to English - then F5 refresh browser page, and they'll be back to French again as required.

    Thanks, Harvey.

  • Aaron
    • CTO

    It appears you are using WPML, and if that's the case then the problem definitely lies there. Seems like their hooks are not being applied inside the wp-ajax.php handler.

    You will need to contact them for a fix. Also, I just worked with them last week to get their bridge updated, perhaps there is a new version already that will fix this. If not it's a bug in the bridge they'll have to fix.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.