I am trying to achieve a new button on the archive which will add the product to the cart, redirect to the checkout page and scroll down to the billing details.
Nothing happens when using this code:
add_filter ('add_to_cart_redirect', 'redirect_to_checkout');
function redirect_to_checkout() {
global $woocommerce;
$checkout_url = $woocommerce->cart->get_checkout_url()#billing_details;
return $checkout_url;
}
It gives on error for this line:
$checkout_url = $woocommerce->cart->get_checkout_url()#billing_details;