wordpress add to cart redirect php
Sure, here is a response:
- Go to your WordPress dashboard.
- Navigate to Appearance > Theme Editor.
- Select the functions.php file from the list of theme files.
- 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');
- Click the "Update File" button to save the changes.