WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce Multilingual - run WooCommerce with WPML
[resolved] Related & Cross-sells not working in WooCommerce (11 posts)

  1. Vayu Robins
    Member
    Posted 1 year ago #

    Hi.
    I have a multilingual shop her: http://youandyou.dk/temp/

    Related & Cross-sells is not working in WooCommerce when WooCommerce Multilingual plugin is activated. So, when I edit a product in the admin and I want add related products in the Linked Products tab, it cannot find any products. When I disable the WooCommerce Multilingual, it can find related products.
    https://www.evernote.com/shard/s3/sh/fd62122a-0423-438a-b693-eef6005279d2/80c2b206c583c897015aa71f63901cd2

    I have tried to deactivate other plugins, but only get this problem when WooCommerce Multilingual is activated.

    http://wordpress.org/extend/plugins/woocommerce-multilingual/

  2. David Garcia Watkins
    Member
    Plugin Author

    Posted 1 year ago #

    I have tried this using WooCommerce 2.0.5 and the development version of WooCommerce multilingual and its working correctly.

    Can you check that you have the latest versions installed? If you want to try a development version, you can download it from the "developers" tab.

  3. Vayu Robins
    Member
    Posted 1 year ago #

    Hi David.
    Thanks for helping out.
    That is weird!
    I am using WordPress 3.5.1, WooCOmmerce 2.0.5, WPML 2.7.1 and WooCommerce Multilingual 2.0. I have now tested it with WooCommerce Multilingual 2.1 as well. I still get no results. I have testet it with different themes and uninstalled all plugins except WooCommerce, WooCommerce Multilingual, and WPML.

    No luck.

    I have then tried to find where the problem was and I ended up in this function search_products() in woocommerce_wpml.class. This does not return the current language $sitepress->get_current_language(), so this runs on all found unset($found_products[$product_id]);

    Does this make any sense to you?

    Thanks
    Vayu

  4. David Garcia Watkins
    Member
    Plugin Author

    Posted 1 year ago #

    Yes, I know. I've looked at $sitepress->get_current_language() and it works ok here.

    Do you also have Translation Management and String Translation enabled?

  5. Vayu Robins
    Member
    Posted 1 year ago #

    Yes, they are both enabled and are running latest version. I wonder why $sitepress->get_current_language() returns nothing on this site...

  6. Vayu Robins
    Member
    Posted 1 year ago #

    Would it be alright to remove the filter in my theme functions.php?
    remove_filter('woocommerce_json_search_found_products', 'search_products');
    It works when I do that.

    What would the consequences of that be?

  7. David Garcia Watkins
    Member
    Plugin Author

    Posted 1 year ago #

    You would get to choose from products in all languages.

    Can you try changing the priority to 12 on line 8 so it reads:
    add_action('plugins_loaded', array($this, 'init'), 12);

    I should try myself first, but its working here.

  8. Vayu Robins
    Member
    Posted 1 year ago #

    Hi David.
    Thanks for your suggestion. I have actually already tried this and it doesn't work.

    I give up and will just unhook the search_products filter. It's better to have all rather not than not having any search results.

    I really appreciate your help and guess that it must be something on my setup, that is no interfering.

    Thanks
    Vayu

  9. Vayu Robins
    Member
    Posted 1 year ago #

    This is how I unhooked the filter in my theme functions.php file:

    add_action( 'init', 'remove_search_products', 10 );
    function remove_search_products() {
    	remove_filter('woocommerce_json_search_found_products', array($GLOBALS['woocommerce_wpml'],'search_products'), 10);
    }
  10. David Garcia Watkins
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Vayu,

    Thanks for sharing your solution, if you want to investigate this issue further you can post a topic at wpml.org support forums. We can share login information and debug the issue further.

    Best,
    David

  11. David Garcia Watkins
    Member
    Plugin Author

    Posted 7 months ago #

    I'm marking this topic as resolved because the problem was solved 8 months ago.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic