` I have created as plugin for wordpress, i have used "woocommerce_get_checkout_url" hook to change checkout button redirection. It is working fine in older versino of wordpress, but not working in wordprss verion 6.4.3 Here is a code.
add_filter( 'woocommerce_get_checkout_url', 'custom_checkout' );
function custom_checkout(){
if ( isset( $\_SESSION\['ReturnURL'\] ) ){
return get_home_url() . '/customcheckout';
}
else {
return get_home_url() . '/checkout';
}
}
Anybody can suggest, what can we do for that ? We have also tried:
add_filter( 'woocommerce_get_checkout_url', 'custom_checkout', 30 );
and
add_filter( 'woocommerce_get_checkout_url', 'custom_checkout', 1, 100 );
but it is not working in wordpress 6.4.3
There are some mistakes in your code, you should try the following instead:
Code goes in functions.php file of your child theme (or in a plugin). Tested and works (if the session variable "ReturnURL" exists, the checkout URL is your custom checkout URL).