Client would like the checkout page to load after clicking "Add to Cart." Is that possible?

Yes, it is.
In the wpsc page templates single_product.php, products_page.php, list_view.php and grid_view.php find this line :

<form class='product_form' enctype="multipart/form-data" action="<?php echo wpsc_this_page_url(); ?>" method="post" name="1" id="product_<?php echo wpsc_the_product_id(); ?>">

change the action so this line looks like:

<form class='product_form' enctype="multipart/form-data" action="<?php echo get_option('shopping_cart_url'); ?>" method="post" name="1" id="product_<?php echo wpsc_the_product_id(); ?>">

Basically what we’ve done here is made the form direct to the shopping cart page, but the ajax call will stop this from ever running, so we have to disable the ajax call, so

In js/wp-e-commerce.js around line 93
find this line:

if(file_upload_elements.length > 0) {

and change it to :

if(file_upload_elements.length > 0 || true) {

This line of js usually only triggers if your buyers have a file to upload, since the file cant be uploaded through ajax wp-e-commerce refreshs the page, so we will just piggy back on this and make the condition trigger every time by adding OR true.

Now refresh your page and when you click add to cart you should be directed to the checkout page!

Happy e-commercing~
SCM

51 thoughts on “Client would like the checkout page to load after clicking “Add to Cart.” Is that possible?

  1. @gavins which shortcode are you referring to? its pretty easy really, alter the JS like above, find where the code is generated and replace the forms action, with the shopping_cart_url,,,
    If you let me know which shortcode I may be able to assist.. I am pretty busy atm but sure I can squeeze this in..

    best
    jeff

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>