WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
How to Skip Checkout Page? (2 posts)

  1. barryanders
    Member
    Posted 7 months ago #

    I've got a product category that includes only free products and they are all displaying in a loop. I need to make it so that when a user clicks the "Add to Cart" button, it purchases the product and redirects them straight to the My Account page.

    If that's too difficult, I'm willing to settle on a solution that will automatically activate the submit button on the checkout page if someone can help me achieve that. I've tried this javascript code which has worked for me on ordinary forms so I know it does what it's supposed to do:

    function addtocart () {
    var form = document.getElementsByClassName("checkout")[0];
    form.submit();
    }
    window.onload = addtocart;

    It seems to activate an endless loop of redirecting to the checkout page, rather than purchasing the free product. I'm almost there, but I could really use some help!

    http://wordpress.org/plugins/woocommerce/

  2. barryanders
    Member
    Posted 7 months ago #

    To put it simple, here's the default Woocommerce progression:

    Shop Loop -> Cart -> Checkout -> Order Confirmation -> Account Page

    Here's what I currently have:

    Shop Loop -> Checkout -> Account Page

    I would prefer this:

    Shop Loop -> Account Page

    But am willing to accept this if I can find a way to automatically submit the checkout form when that page loads so the user doesn't have to click anything:

    Shop Loop -> Checkout -> Account Page

Reply

You must log in to post.

About this Plugin

About this Topic