Tags/topics: 
2
Answers
Vote up!
0
Vote down!

Re-order Add To Cart fields

Hello,

What I am trying to do is to change the order of the fields that display in the add to cart form button. Here is a screenshot of the current form:
http://hotsce.co/e8iE

I am trying to essentially move the Wishlist button below all of the items, put Quantity on the top and the Price field above the Add to Cart button. These items are being rendered in a View, and the Price field is actually a separate field from the ones in Add To Cart but I would like a way (other than using CSS) to get that field inside of the Add to Cart form as well.

So basically I need the fields to read like this:
Quantity
Option Set 1
Option Set 2
Option Set 3
Price
Add To Cart Button
Wishlist button

Any help that can be offered would be most appreciated!

Thanks!

Asked by: hotsauce
on August 15, 2013

2 Answers

Vote up!
1
Vote down!

This was a simple hook_form_alter(); Below screencast is the code.

<?php
function YOURTHEME_form_alter(&$form, &$form_state, $form_id) {
 
//dpm($form_id);
 
if (stristr($form_id,"add_to_cart_form")) {
   
//dpm($form);
   
$form['add_to_wishlist']['#weight'] = 99;
  }
}
?>
Josh Miller
Answer by: Josh Miller
Posted: Aug 15, 2013
Vote up!
0
Vote down!

Perfect, just what I was looking for!

Thanks!

Answer by: hotsauce
Posted: Aug 15, 2013