• Resolved dominicht

    (@dominicht)


    Hi,
    I,m running an online shop with packages and subscriptions in both french and english and I recently noticed that I am no longer able to retrieve the correct language of a product id using wpml_get_language_information(). Instead, it always give me the same current language for all products.

    Here’s the code i’m using:

    $product = get_product( $package );
    $language_information = wpml_get_language_information($product->id);
    $locale = $language_information['locale'];

    I’m using woocommerce multilingual 3.6.7

    Any help would be appreciated. My package selection page is a little messed up now with duplicates.

    https://wordpress.org/plugins/woocommerce-multilingual/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for reporting your issue.
    Can you please tell me which WPML Multilingual plugin version are you using?

    Regards,
    Maciej

    Thread Starter dominicht

    (@dominicht)

    WPML : Version 3.2.2

    and i’m also running the following plugins
    WPML Media : Version 2.1.12
    Translation Management : Version 2.0.2

    Thread Starter dominicht

    (@dominicht)

    Just in case this can help someone else, I ended up finding the solution. The hook has been changed to: wpml_post_language_details()

    See this link for more details
    https://wpml.org/wpml-hook/wpml_post_language_details/

    and here’s the working code

    $product = get_product( $package );
    $language_information = apply_filters( 'wpml_post_language_details', NULL, $product->id );
    $locale = $language_information['locale'];

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

The topic ‘Get product language with wpml_get_language_information’ is closed to new replies.