wordpress add to cart redirect php

Sure, here is a response:

  1. Go to your WordPress dashboard.
  2. Navigate to Appearance > Theme Editor.
  3. Select the functions.php file from the list of theme files.
  4. Add the following code at the end of the file:
function redirect_after_add_to_cart() {
    global $woocommerce;

    $checkout_url = wc_get_checkout_url(); // Replace with the URL you want to redirect to

    return $checkout_url;
}
add_filter ('woocommerce_add_to_cart_redirect', 'redirect_after_add_to_cart');
  1. Click the "Update File" button to save the changes.