Redirect 'add to cart" button to different page

Hi guys!

I’m making a Job board site in which the user is paying for advertising space rather than a physical product. I’m trying to set up the eCommerce to reflect this.

The user flow I would like is - User selects price package (package is added to cart in the background, without the user seeing the cart) > User fills in form with details of advertisement > user checks out.

So essentially, I want to bypass the user ever seeing the cart as they shouldn’t be able to add more than one item to the cart as each payment required a separate form to be filled in.

Is there a way, I can redirect the “add to cart” button to the job post form page? so the process is more seamless. (i don’t want to redirect it to the cart as there is the middle step of filling out the details form)

*I know this isn’t the best user flow but trying to make it work within webflow limitations

  • My client doesn’t want to use any 3rd party form providers because of cost

Thanks! :slight_smile:


Here is my site Read-Only: LINK
(how to share your site Read-Only link)

I think some custom code like

$("#BUTTON_ID").on("click", function(event) {
    window.location.href= "LINK_TO_PAGE"
});

should do the trick.

Didn’t seem to work, unfortunately :frowning: I added it to the footer tag and added script tags
Is this how you would have added it? (sorry I’m not a dev)

I managed to get it working on the very first ‘package’ using -

<script>
function addToCartAndCheckout() {
document.getElementById('add-to-cart').click();
 window.location = '/submit-job';
}
var buyNow = document.getElementById('buy-now');
buyNow.addEventListener("click", addToCartAndCheckout);
</script>

However, it didn’t seem to work on the second or third packages. I’m not sure if this was an issue with the button being generated by the CMS?

I think the issue may be that only one element can be identified by an ID. If you identify multiple elements by the same ID, things probably won’t work as expected.

I’d suggest setting a different ID on each button (assuming you have multiple buttons) and then creating a similar function for each button