WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Bug in WooCommerce_Widget_Product_Categories (3 posts)

  1. Artprima
    Member
    Posted 1 year ago #

    There is a bug in WooCommerce when using it with WPML and language indication way via ?lang=XX parameter.

    The bug can be found here:

    <script type='text/javascript'>
                /* <![CDATA[ */
                    var dropdown = document.getElementById("dropdown_product_cat");
                    function onCatChange() {
                        if ( dropdown.options[dropdown.selectedIndex].value !=='' ) {
                            location.href = "<?php echo home_url(); ?>/?product_cat="+dropdown.options[dropdown.selectedIndex].value;
                        }
                    }
                    dropdown.onchange = onCatChange;
                /* ]]> */
                </script>

    echo home_url() produces for example http://site.com/?lang=es and then you add /?product_cat=XXXX resulting http://site.com/?lang=es/?product_cat=XXXX

    Can be seen here:
    http://fridja.com/product-category-f-1000-fr/?lang=fr

    I consider it a bug because you may not rely on home_url() this way since it may be filtered by plugins (as in this case).

  2. helgatheviking
    Member
    Posted 1 year ago #

    the FAQ requests that you report bugs at the WooCommerce GitHub repository. Unlikely the WC devs will see your report here.

  3. Artprima
    Member
    Posted 1 year ago #

    Yeah, I get it. Anyway, changing url structure to http://site.com/lang_code/ solves the problem.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags