• awaaxyb

    (@awaaxyb)


    Hello we use CheckoutWC and we find something strange not user friendly, when user is on the checkout he is redirected to the base country homepage and not taking into consideration his country.

    Base country is UK
    And we have NL has another country.

    When NL user are on the checkout site.com/nl/checkout/ and they click on the logo, the logo point to site.com/ and not site.com/nl/

    We want to know why ? Can u explain how to set this or maybe do an update ?

    We kindly ask CheckoutWC developers if it was their responsability and that’s the reply they give today :

    This is the code that determines where the logo links to:
    $url = apply_filters( ‘cfw_header_home_url’, get_home_url() );
    I’m surprised that polylang isn’t filtering the home URL, or detecting the user’s language and redirecting to the language specific version.

    You could add your own filter on cfw_header_home_url

    But I would ask Polylang how this is supposed to work – if we are doing something wrong we are happy to make a change.

    CheckoutWC developer reply to this problem
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Chouby

    (@chouby)

    Hello,
    Filtering the home URL is tricky. In some places, it is needed and in other places, it would break things.
    So we have a mechanism to decide which calls must be filtered and which must not be filtered. It’s ok for WordPress and some known plugins but we can’t know every plugins.
    So by default, the home URL is filtered in themes and not filtered in plugins. The filters pll_home_url_white_list and pll_home_url_black_list allow to change this default behavior.
    However, in your case, using the filter cfw_header_home_url as suggested would be easier and more efficient:

    add_filter(
    	'cfw_header_home_url',
    	function( $url ) {
    		return function_exists( 'pll_home_url' ) ? pll_home_url() : $url;
    	}
    );
    Thread Starter awaaxyb

    (@awaaxyb)

    Hello,

    Thanks for this answer, we will give it to plugin dev and share the result

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Checkout to homepage wrong redirect url’ is closed to new replies.