WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Redirect to checkout on add to cart (1 post)

  1. seforoth
    Member
    Posted 6 months ago #

    Hi Everyone =)

    I'm doing a 1 page website/shop for a client and was hoping that redirecting to checkout when clicking on an add to cart button would be easy but sadly no such luck. Here is what I've tried.

    First I used the products shortcode to show the products on my front page:
    <?php echo do_shortcode('[products skus="2msb, 3msb, 4msb, 6msb" columns="2"]') ?>

    Then I replaced the default add to cart button from the content-product.php file with the following:
    <a href="/checkout<?php echo $product->add_to_cart_url(); ?>" class="btn btn-success">Order Now</a>

    But everytime I click on the links they always end up being as something like this:
    http://website.com/?add-to-cart=22
    While they should be redirecting to the checkout page and looking more like this:
    http://website.com/checkout/?add-to-cart=22

    I swapped the add-to-cart=12 with something silly like test=123 as to see if it would redirect to the checkout page and it worked! It just refuses to do it for add-to-cart parameter.

    Thank you very much for any help! =)

    Edit: Here is the link to the tutorial that I got the idea from http://proserveweb.com/create-woocommerce-link-add-product-cart-redirect-checkout/

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

Reply

You must log in to post.

About this Plugin

About this Topic