Wrong language after checkout – WITH SOLUTION
-
I’ve found a bug and created a solution.
Bug: after checkout I got wrongly translated emails. The problem is in resolving
redirect_uri. It washttps://example.com/https://example.com/en/checkout/...instead ofhttps://example.com/en/checkout/
The solution: inincludes/gettext/class-gettext-manager.phpinis_ajax_on_frontend()I’ve removed home path from the request URI:// Trim path info from the end and the leading home path from the front
$req_uri = ltrim( $req_uri, '/' );
$req_uri = preg_replace( $home_path_regex, '', $req_uri );
// remove home path from request URI
$req_uri = str_replace( $url_converter->get_abs_home(), '', $req_uri ); // <---- THIS LINE HAS BEEN ADDED
$req_uri = trim( $url_converter->get_abs_home(), '/' ) . '/' . ltrim( $req_uri, '/' );
$referer = $req_uri;Please fix it as soon as possible, so I don’t need to fix it manually every time I update the plugin.
You’re welcome.
BTW: Write some tests for this code, would you? It’s a mess down there.
The topic ‘Wrong language after checkout – WITH SOLUTION’ is closed to new replies.