1
Answers
Vote up!
0
Vote down!

Skip shopping cart & add checkout form to product display page?

I am using Drupal Commerce for the purchase and registration of classes (like college courses). I am wondering if it's possible to alter the workflow like so: Product Display page contains the registration and checkout forms to directly purchase that specific course - skip the Shopping Cart and separate Checkout pages. There are no variations or dynamic attributes on the product to consider: it is a simple single product. I understand users would only be able to purchase one at a time.

I am new to Drupal Commerce (didn't use Kickstart though) and only an intermediate Drupal user, so I would appreciate really any thoughts/guidance/tutorials on how I can accomplish this, please. I found this thread which touches on the kind of functionality I need - http://www.drupalcommerce.org/discussions/541/make-add-cart-button-go-st... - However, I want to take it a step further by also merging the product display with the checkout form. I am assuming this would involve Views and possibly Rules, but I'm not sure where to even start! A View page displaying the product, where the Checkout section is a (View?) block? Where the checkout's Submit button somehow receives the product ID from the product display View?

Asked by: Sammii
on October 8, 2013

1 Answer

Vote up!
0
Vote down!

What you're looking to do could be possible through a custom module embedding the checkout form on those pages, but simply through configuration it isn't possible. The big issue you'd have is that in order to display a checkout form, you need an order representing the intended purchase. You could maybe get away with a blank order that isn't saved until the purchase form is submitted, populating it with course information on submission, but I'm not sure that's foolproof. At the end of the day, you'd still need an extra step to handle payment.

The ideal way for such a system to work would be if the customer has given you payment credentials somewhere else. It doesn't sound like that's what you want, though, and given that you're only an intermediate Drupal user, I'm not sure it's worth pursuing.

The best intermediate solution I could recommend would be a custom "Buy it now" type button where clicking on the button on the product page creates a cart order with that product in it and redirects to the checkout form. I don't believe there's a module for that yet, but it's worth a search.

Ryan Szrama
Answer by: Ryan Szrama
Posted: Oct 9, 2013

Comments

Thanks so much for your reply Ryan! I think embedding the checkout form onto the Product Display is out of scope for me. I am trying to implement an alternative that will still make the client happy. I'm very close, but hitting a road block and wondering if you have any further guidance?

I am trying to do two things that don't want to behave simultaneously:

1. Implement your suggestion of a "Buy Now" button that redirects to checkout page when "Add to Cart" button is clicked. I have that working on a basic level. I created a new Rule that redirects to URL "checkout" on event "After adding a product to the cart."

2. I am using Commerce Registration module and have tweaked it to create a one-page checkout. (By going to Store Checkout settings and moving the "Registration Information" section out of the Registration Pane and into the Checkout Pane.) Doing this caused the issue documented here: https://drupal.org/node/1829334 which I was able to fix by adding the code from #3 to my template.php file.

HOWEVER, trying to do both these things at once causes my second issue to pop up again. After clicking "Add to Cart" the user is taken to checkout/5 (5 being order ID) which is the borked Registration Information page.

If I disable my redirect Rule, clicking the "Checkout" button on the cart goes directly to a URL of checkout/5/checkout and displays the correct one-page checkout. However, if I try to link to that URL directly from my redirect Rule itself by setting the URL to "checkout/[commerce-order:order-id]/checkout", it continues directing to checkout/5 instead no matter how much I try and mess with the Rule settings.

I hope that makes sense; it's very difficult to explain!

- Sammii on October 17, 2013

Not sure I really follow what's going on here, to be honest. checkout/## and checkout/##/checkout are typically always going to redirect to the same page. It could be that Commerce Registration is injecting a prior checkout page that's giving you trouble, but I haven't used the module to know how to advise.

- Ryan Szrama on November 4, 2013

I believe you are right about it being an issue with Commerce Registration. I will just have to work around it. Thanks so much for your assistance Ryan. :)

- Sammii on November 5, 2013