window.location.href.To dynamically redirect users after a Webflow form submission based on their plan and ad spend choices—especially when integrating with an external subscription/payment service—you need to handle the logic with a combination of custom JavaScript and conditional redirects.
Example (simplified):
id or class.submit, prevent the default action.
<script>
document.addEventListener("DOMContentLoaded", function () {
const form = document.querySelector("#your-form-id");
if (!form) return;
form.addEventListener("submit", function (e) {
e.preventDefault();
const plan = form.querySelector('select[name="plan"]').value;
const adSpend = form.querySelector('select[name="ad-spend"]').value;
// Construct dynamic URL (example)
let redirectURL = "";
if (plan === "Pro" && adSpend === "500") {
redirectURL = "https://your-payment-service.com/checkout/pro-500";
} else if (plan === "Basic" && adSpend === "1000") {
redirectURL = "https://your-payment-service.com/checkout/basic-1000";
} else {
redirectURL = "https://your-payment-service.com/checkout/default";
}
// Optional: Send form data to Webflow or a backend before redirecting
// Redirect the customer
window.location.href = redirectURL;
});
});
</script>
#your-form-id with the actual CSS ID of your form (you can assign one in Webflow Designer).redirectURL logic to match your payment service’s URL schema (e.g., Stripe Checkout links, Paddle plan IDs, etc.).
fetch() to submit the form data to Webflow’s form endpoint or your server.window.location.href.
To create a dynamic redirect in Webflow forms based on plan and ad spend:
window.location.href.
Make sure to disable Webflow's default redirect and test all combinations carefully.