Redirect to checkout on add to cart
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:
While they should be redirecting to the checkout page and looking more like this:
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/
- The topic ‘Redirect to checkout on add to cart’ is closed to new replies.