Payment method to cart page I need to move the payment method from the checkout page in drupal commerce and embed it into the cart page. is that even possible? I have been finding some resources and it does not lead me anywhere.

I believe I will need a custom module for this and which hook should I used for presenting a payment option in the cart page and when hitting 'checkout' button it will just go and review everything. so payment is processed in the cart page also.

thank you
It's actually very straight forward! If you want to not completely override the /cart url (basically, leaving the /cart in tact, but simply link key user interface elements directly to checkout) then you can skip to step 2...

Step 1: Overriding the cart view



You will want to do three things: 


First, you'll want to "alias" the "/cart" to "/checkout" (see screenshot above) ... this will ensure all system links that go to cart actually just link to "/checkout"
Second, you'll want to override the system path "/cart" and have it redirect to an appropriate location. (code below)
Finally, you'll need to disable the view "Shopping cart form" (otherwise our hook_menu_alter may not work).


See verified code below (as in I checked to make sure this works).

&lt;?php 
function mymodule_menu_alter(&amp;$items) {
  $items['cart']['page callback'] = '_mymodule_redirectcart';
}
function _mymodule_redirectcart() {
  global $user;
  $account = $user;
  $cart = commerce_cart_order_load($account-&gt;uid);

  // if user doesn't have a cart, go to &lt;front&gt;
  // else if user's cart is empty
  if ($cart == false || count($cart-&gt;commerce_line_items) == 0) {
    drupal_goto('&lt;front&gt;');
  }

  // go to checkout
  drupal_goto('checkout/'.$cart-&gt;order_id);
}
?&gt;


Don't forget to disable the shopping cart form



Step 2: Making a one page checkout

I borrowed the step-by-step from an excellent "Express Checkout" blog.


From http://www.example.com/admin, click on the Store link, then Configuration, then Checkout settings
Drag the Review item out of the Review order section and into the disabled section
Drag the Payment item out of the Review order section and up into the Checkout section
Click Save Configuration




Step 3: Modify the title and button

This step is optional, but useful. Basically, we just use hook_form_alter to change the "Continue" button to indicate that payment will be taken and we modify the page title to "Cart" to further our ruse that this is the cart page and not checkout.

&lt;?php
function mymodule_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  if ($form_id == 'commerce_checkout_form_checkout') {
    drupal_set_title("Cart");
    $form['buttons']['continue']['#value'] = t('Proceed with purchase');
  }
}
?&gt;


Step 4: Your new cart checkout

This is not really a step, but it is the result of your effort. Now your new "cart" has a checkout/payment pane. Only thing you would be missing from the original cart is the ability to modify your cart (remove products) and that is where this process would fail you. 



Other Thoughts

If your customers will need to be able to modify the cart (most likely the case), then you will need to link to a clone of the commerce_cart_view at a unique url (perhaps /cart-edit?) and then add a link called "Edit Cart Contents" in the footer of your cart contents view to indicate that they can remove items, but they have to click a link to do it. 




The view you want to clone is called "Shopping cart form" and the clone option can be found at /admin/structure/views
Make sure you edit the path in your cloned view to "cart-edit" or some variation.
Edit the footer of the "Shopping Cart Summary" view found at /admin/structure/views/view/commerce_cart_summary/edit to look like the below:




The reason you can't modify cart items in checkout is that "forms within forms" is not a straightforward thing to implement, but linking to a view to edit your order is pretty simple and everyone wins with a 10 minute change.